I have a function which is defined like this:
typedef void (*logprintf_t)(const char* format, ...);
logprintf_t logprintf
void my_function() {
logprintf = cast(logprintf_t)0x12345;
}
and it causes the application to exit. However, if I make the logprintf be static (I've seen this trick somewhere), i.e.:
void my_function() {
static logprint_t logprintf = cast(logprintf_t)0x12345;
}
it doesn't crash.
Is it such a language rule thing or kind of bug? Why dmd doesn't warn be about this?