C Interview Questions and Answers

 

How can I list all of the predefined identifiers?

There's no standard way, although it is a common need. gcc provides a -dM option
which works with -E, and other compilers may provide something similar. If the compiler
documentation is unhelpful, the most expedient way is probably to extract printable
strings from the compiler or preprocessor executable with something like the Unix
strings utility. Beware that many traditional system-specific predefined identifiers
(e.g. ``unix'') are non-Standard (because they clash with the user's
namespace) and are being removed or renamed. (In any case, as a general rule, it's
considered wise to keep conditional compilation to a minimum.)

Posted by:Richards