I have an MPI program that I'm developing on a local computer, but need to run on a remote machine. I used clock() to measure time, but after discovering that it doesn't work well enough on the remote machine (due to a completely different architecture), I replaced a few calls to clock() with MPI_Wtime(), which yielded the required resul...
Hello,
I am trying to give my ComboBox an in place tooltip for long strings. However when I call SetWindowPos on the tooltip, the position is never changed. Called when TTN_SHOW is received:
::SetWindowPos(textTooltip, NULL, TipRect.left, TipRect.top, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER);
If I remove the SWP_NOSIZE flag ...
Is it possible to do this kind of specialization?
If so, how?
The specialization in question is marked //THIS SPECIALIZATION WILL NOT COMPILE
I have used VS2008, VS2010, gcc 4.4.3 and neither can compile this.
I know i can avoid this by overloading func but i want to know if there is a way to do this with template specialization. (impr...
Hi all,
Boost serialization doc's assert that the way to serialize/deserialize items is using a binary/text archive with a stream on the underlying structure. This works fine if I wan't to use the serialized data as an std::string, but my intention is to convert it directly to a char* buffer. How can I achieve this without creating a te...
it doesn't work for me.
i have a header file and a cpp file.
need to define a conversion operator from my class to INT, but it gives me "syntax error" when declaring it in the H file and implementing in the cpp file. maybe i got the syntax wrong?
in the H file i have in "public":
operator int();
and in the cpp file i have:
A::operato...
I'm not sure if I am going about this the right way. I am making some c++ classes to use in 2 apps. I am going to have to compile them to be used in a Cocoa app and later be compiled for use with fastcgi.
Should I create a dynamic library?
...
Why is the following code invalid?
template <typename S, typename T>
struct B{
void f(T t, S s) {t.f<S>(s); }
};
gcc 4.3.4 complains that it "expected primary-expression before '>' token", i.e. that "S" wasn't a valid primary-expression.
...
Is there any way to know if you program has undefined behavior in C++ (or even C), short of memorizing the entire spec?
The reason I ask is that I've noticed a lot of cases of programs working in debug but not release being due to undefined behavior. It would be nice if there were a tool to at least help spot UB, so we know there's the...
I have data from socket, which is header and message.
Header if of 5 bytes, 3rd and 4th is message length.
I am reading from socket, can someone suggest me good function, it will return me msg.
assuming that i am reading 1024 bytes and it may happen that i have recived only partial data.
...
I have a QWidget that contains various other widgets. I want to animate it appearing on the screen by gradually revealing it from the top down, increasing it's height from 0 to whatever it's natural height would be.
The way I have it currently is:
mAnimation = new QPropertyAnimation(this, "maximumHeight");
mAnimation->setStartValue(0)...
Hi,
I have a small C++ dll which was written in Visual Studio (of course).
In the solution code, I have a resource file that includes only version information.
The strange dact is, that when I frag the compiled dll to Visual Studio, it opens a resource viewer with bitmaps, dialogs and a string table - where do all of them come from??
...
I have a directroy where I have several pictures and gif animations. I want to post that pictures and animations on a QDialog in an infinite loop (by cyclically changing pictures in 2 minutes interval) and on that pictures and animations I want to set a link so that when you click the browser open the set link.
How I could do this?
Ple...
I am writing a very high performance application that handles and processes hundreds of events every millisecond.
Is Unmanaged C++ faster than managed c++? and why?
Managed C++ deals with CLR instead of OS and CLR takes care of memory management, which simplifies the code and is probably also more efficient than code written by "a pro...
Is it possible to call a function in a DLL loaded dynamically without making use of function pointers.
...
Using gcc 4.4.3 on Linux 2.6.32, I get bad_cast exceptions when connecting std::basic_ofstream to a FIFO.
Stepping though the debugger, I can see that the error is generated at various places in the standard library because the _M_codecvt member of the stream or filebuf object is NULL. Exactly where it happens depends on the order of op...
I am currently studying COM. I found that COM DLL is kind of built upon the traditional DLL infrastructure. When we build COM DLLs, we still rely on the traditional DLL export methods to lead us to the internal COM co-classes.
If COM is for component reusing at the binary level, I think the traditional DLL can achieve the same thing. T...
I want to run the app in silent mode by passing in a parameter, otherwise I will show the window.
...
class MyClass
{
static int staticInt;
void instanceMethod( int param )
{
static int parameter = param;
}
}
Clearly staticInt is shared between all instance of MyClass. But can different instances of MyClass have different values of parameter the static local variable within instaceMethod?
Update
What about between progr...
class A
{
private:
int m_nValue;
public:
A()
{
m_nValue = 0;
}
A(int nValue)
{
m_nValue = nValue);
~A()
{}
}
Now in main if i call
A a(2);// 2 will be assigned for m_nValue of object A.
Now how do we do this if i want to define an array of objects.
Also how do we do this if i dynamically create objects using operator new
like
A *...
How could I call a function from a DLL ?
I tried to declare a void pointer and to store in it the result of GetProcAddress... but didn't work. I also wanted to declare an unsigned long int ( I saw it somewhere on the internet ), but then I didn't know how to continue on. :D
So, would anybody mind giving me a hand ?
...