This is a common and a funny problem. So what is this all about? Let me put it like this…
We have a standard “c” function called _toupper and an equivalent macro is also available called _toupper. So my question is how to call function version of _toupper explicitly, if we write _toupper, macro version get expanded inline, since preprocessor runs before compiler.
Here is the solution…
const char upper = _toupper( ch ); // Will invoke macro version
const char upper = (_toupper)(ch); // Will invoke function[/sourcecode]
Another routine is _fileno, implemented both as a function and as a macro. Apply same trick.
[sourcecode language=’cpp’]const int ErrFileNo = (_fileno)( stderr );
const int OutFileNo = _fileno( stdout );[/sourcecode]
Another option is to use #undef to undefine the macro definition.
A friend of mine was saying that he did encounter such bugs due to such “automagic” macro expansion.