I have a bunch of printf debug helper macros and it would be pretty cool to have to not specify the type, is there anything you can do to allow something like macro overloading
I think you can give a try with following code:
#define DPRINT(fmt) do{ \
my_printf fmt ; \
} while(0)
my_printf( const char* szFormat, ... )
{
char szDbgText[100];
va_start(args, szFormat);
vsnprintf(&szDbgText,99,szFormat,args);
va_end(args);
fprintf( stderr, "%s", szDbgText );
}
// usage
func( )
{
int a = 5;
char *ptr = "hello";
DPRINT( ("a = %d, ptr = %s\n", a, ptr) );
}
Note: DPRINT usage takes dual parentheses here.