How can I device an algorithem for deadlock detection through an Injecting DLL containing the hooked Functions for locking and Unlocking.
Actually I want to device and algorithem for deadlock detection. Kindly if someone could me in this regard.
...
I am trying to submit the solution of Adding Least Common Multiples(July contest) in codechef.com.
But
After submission I have got an error
/sources/tested.cpp:1: error: expected unqualified-id before numeric constant
what is it mean?
I did not get any error when I compiled in eclipse(helios) using mingw32-g++
...
Hi,
I've just inherited some C++ code which was written poorly with one cpp file which contained the main and a bunch of other functions. There are also .h files which contain classes and their function definitions.
Until now the program was compiled using the command "g++ main.cpp". Now that I've seperated the classes to .h and .cpp f...
I have a static class data member declared as:
static const float MINIMUM_ZOOM_FACTOR = 4.0;
I'm using this constant in a class member function like this:
zoomFactor_ = max(zoomFactor_, MINIMUM_ZOOM_FACTOR);
At this point, the compiler complains that MINIMUM_ZOOM_FACTOR is an undefined reference. However if I use it directly like t...
I'm using C++Builder, and am trying to slowly migrate code to using C++ standard library in preference to the Delphi VCL.
The VCL has a streaming architecture based around the TStream class, and I'm switching to using std::stream instead. However, in the short term, I still need a way of 'mixing' use of the two stream types.
I can do ...
In most web (PHP) apps, there is mysql_connect and some DB actions which means that if 1000 users is connected, 1000 connections are opened?
But with C++ app it is incredibly slow...what is the main difference?
Thanks
...
In a derived class If I redefine/overload a function name from a Base class,
then those overloaded functions are not accessable/visible to derived class.
Why is this??
If we don't overload the oveloaded function from the base class in derived class
then all the overloaded versions of that function are available to derived class
objec...
Once again, I wish C++ had stronger typedefs:
#include <vector>
template<typename T>
struct A {
typedef std::vector<T> List;
};
template<typename T>
void processList(typename A<T>::List list) {
// ...
}
int main() {
A<int>::List list;
processList<int>(list); // This works.
processList(list); // This doesn't.
...
In a VS2008 debug build of my Windows mobile 6 application, I'm getting an exception thrown whenever I try to write to a newly created CFile using a CArchive. The call stack, with relevant code inserted, is as follows;
MFC90UD.DLL!ATL::CTime::CTime(int nYear = 60056, int nMonth = 5, int nDay = 27, int nHour = 22, int nMin = 44, int nSe...
Hi.
I'm working on a game with SDL in Visual Studio 2010. I came across the _CrtDumpMemoryLeaks() macro and thought I'd give it a go. Invoking _CrtDumpMemoryLeaks() does print memory leaks to the output window, but it does not show where it happens.
I've read the MSDN article at http://msdn.microsoft.com/en-us/library/e5ewb1h3(v=VS.80)...
I'm writing a GUI application, using Qt, which links to a third-party DLL that sometimes sends error messages to stderr. I'd like these error messages to be displayed in a window within my GUI.
I couldn't find an established way to redirect stderr (as opposed to std::cerr) even after much searching, so I wrote the following class myself...
Hi,
I am having a problem with precision of a double after performing some operations on a converted string to double.
#include <iostream>
#include <sstream>
#include <math.h>
using namespace std;
// conversion function
void convert(const char * a, const int i, double &out)
{
double val;
istringstream in(a);
in >> val;
...
From the documentation on the boost site for lexical cast it states that when converting from a numeric type to a string type the conversion can throw a bad_lexical_cast. Clearly in this case we should always handle this exception should it be thrown.
My question is, what about the other way around, going from a numeric type to a string...
Let's suppose that we have the following scenario: something is playing on an android device (an mp3 par example, but it could be anything that use the audio part of an android device). From an application (android application :) ), I would like to intercept the audio stream to analyze it, to record it, etc. From this application (let's ...
Probably an easy beginners question: I want to add the compiler flag /EHsc to my project and tried both
SET_TARGET_PROPERTIES(name_of_my_project PROPERTIES COMPILER_FLAGS "/EHsc")
and
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
in my CMakeLists.txt. With both, CMake generates a Visual Studio Solution without complaining.
EDI...
What is the main function of sizeof (I am new to C++). For instance
int k=7;
char t='Z';
What do sizeof (k) or sizeof (int) and sizeof (char) mean?
...
In stackoverflow.com I have found a question where a user was suggesting to use this libraries of KDE in order to export-inport RTF files. But, when I downloaded I saw that there are lot of files that are included in the .cc and .h files that are missing. So please give a hint how to download all necessary files and is there any guide th...
Hi all,
I have a method like this
template<typename T, typename U>
map<T,U> mapMapValues(map<T,U> old, T (f)(T,U))
{
map<T,U> new;
for(auto it = old.begin(); it != old.end(); ++it)
{
new[it->first] = f(it->first,it->second);
}
return new;
}
and the idea is that you'd call it like this
BOOST_AUTO_TEST_CA...
Hi all,
i have a static library which (among other things) implements a tiny function that only returns some string from a table of const strings. This function is not called anywhere inside the library, but still it's declared as inline. For clarity, it looks like this:
namespace flow
{
inline const char* GetName( BYTE methodType ...
I'm trying to read an entire stream (multiple lines) into a string.
I'm using this code, and it works, but it's offending my sense of style... Surely there's an easier way? Maybe using stringstreams?
void Obj::loadFromStream(std::istream & stream)
{
std::string s;
int p = stream.tellg(); // remember where we are
stream.seekg...