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 is there too. The former works on both GCC and VC++ compilers, while the latter only on VC++. Now we all know that both the above statements will be treated as no operation and no respective code will be generated; but here's where I've a doubt.
In case of __noop
, MSDN says that it's a intrinsic function provided by the compiler. Coming to (void) 0
~ Why is it interpreted by the compilers as no op? Is it a tricky usage of the C language or does the standard say something about it explicity? Or even that is something to do with the compiler implementation?