DEBUG macro with __FILE__ __LINE__ | developer.brewmp.com DEBUG macro with __FILE__ __LINE__ | developer.brewmp.com

Developer

DEBUG macro with __FILE__ __LINE__

Forums:

#ifdef _MYDEBUG_
#define MYDEBUG(X) ((0),DBGPRINTF X)
#endif

#ifndef _MYDEBUG_
#define MYDEBUG(X)
#endif

The above works quite well as I can sprinkle my code with:

MYDEBUG(("Hello",__FILE__,__LINE__));

and we I build with no _MY_DEBUG_ defined, the MYDEBUG stuff is dropped. However, how can I improve the macro so I won't have to type __FILE__,__LINE__ everywhere?

Yeah, I have only a very rudimentary understanding of the C/C++ preprocessor. :D

Thanks...