Browsing among some legacy code I've found such function:
static inline bool EmptyFunc()
{
return (void*) EmptyFunc == NULL;
}
What are the differences from this one:
static inline bool EmptyFunc()
{
return false;
}
This code was created to compile under several different platforms, like PS2, Wii, PC... Are there any reason to use the first function? Like better optimization or avoiding some strange compiler misbehavior?
false, the compiler would be free to optimize away that function... but then anywhere that actually used it should prevent the same optimization. Hmm. Where isEmptyFuncused? Also, why the cast tovoid*? That doesn't make sense for function pointers...EmptyFuncwas used as a callback in user input registering procedure, which would go through each registered callback and mark corresponding event as triggered when given callback returns true.