Mark Tomas <mbt99@...> writes:
> What you CAN'T do is this:
> printf ("%d\n",
> #ifdef SOMETHING
> As this will fail on systems where printf is a macro.
Just FYI: a C library implementation must provide non-macro versions
of standard functions such as printf, even if it does use macros for
them by default. There are various ways you can bypass the macro and
get the actual function. In the above case the easiest approach is to
put parentheses around the function name:
Since the first preprocessor token after "printf" is no longer an
lparen, a function-like macro called "printf" would not be substituted
here. ISO C90 7.1.7 discusses this in more detail.
Get latest updates about Open Source Projects, Conferences and News.