2 ms·
Undefining the macro definition of a standard function is an approach described in the very ISO C standard itself. I have the 1999 version of the standard in P
by kazinator 8y ago
Undefining the macro definition of a standard function is an approach described in the very ISO C standard itself.
I have the 1999 version of the standard in PDF form handy. Let's see,
7.1.4 Use of library functions
1 [... snip ...] Any macro definition of a function can be suppressed locally by enclosing the name of the function in parentheses, because the name is then not followed by the left parenthesis that indicates expansion of a macro function name. For the same syntactic reason, it is permitted to take the address of a library function even if it is also defined as a macro. The use of #undef to remove any macro definition will also ensure that an actual function is referred to.
Nothing dubious about using #undef to remove a macro definition of a library function.
There probably isn't a select macro; the #undef is just in case there is one, so that when we #define our own, we don't get a diagnostic about a redefinition with a different token replacement sequence.