I have seen debug printfs in glibc which internally is defined as (void) 0, if NDEBUG is defined. Likewise the __noop for Visual C++ compiler
I think you are talking about glibc, not glib, and the macro in question is the assert macro:
In glibc's , with NDEBUG (no debugging) defined, assert is defined as:
#ifdef NDEBUG
#if defined __cplusplus && __GNUC_PREREQ (2,95)
# define __ASSERT_VOID_CAST static_cast
#else
# define __ASSERT_VOID_CAST (void)
#endif
# define assert(expr) (__ASSERT_VOID_CAST (0))
#else
/* more code */
#endif
which basically means assert(whatever); is equivalent to ((void)(0));, and does nothing.
From the C89 standard (section 4.2):
The header
defines theassertmacro and refers to another macro,NDEBUGwhich is not defined by
. IfNDEBUGis defined as a macro name at the point in the source file whereis included, theassertmacro is defined simply as#define assert(ignore) ((void)0)
I don't think defining a debug print macro to be equal to (void)0 makes much sense. Can you show us where that is done?