From: http://doc.qt.nokia.com/4.7/signalsandslots.html
Callbacks have two fundamental flaws: Firstly, they are not type-safe. We can never be certain
Well, say Qt wants you to give him a callback that takes a pointer to a QString as its argument: your C++ typedef for the call back will look like:
typedef int (*callback_function)( QString *string);
Now, when this callback is called, you can never be sure that the argument passed is really a QString: in C++, this statement is valid and will very likely crash your callback:
int MyCallback( QString *string )
{
if(string)
printf("QString value: %s\n", string->toAscii());
}
/* in another function */
char *badQstring = "Booohhh";
MyCallback( (QString *)badQstring ); // crash, badQstring is not a QString!
Since C++ allows casting, you can never be sure of what type is actually passed to your callback. But, well, this statement is valid to whatever function, even if not a callback.