views:

102

answers:

1

The Evolution WG Issues List of 14 February 2004 has ...

EP003. #nomacros. See EI001. Note by Stroustrup to be written.

In rough (or exact) terms, what is #nomacros, and is it available as an extension anywhere? It would have been a useful diagnostic tool in a recent project involving porting thousands of files of 1995-vintage C++ to a 2005 compiler, compared to the alternative of running the code through the preprocessor and examining the .i files for surprise packages.

+1  A: 

It is just a proposal under active consideration for inclusion into C++, but still not available in the current compilers. If you read further down the page, it says:

ES042. #nospam.

Provide a preprocessor mechanism for limiting macros entering and exiting a scope. For example:

#nomacros
#in A B
…
#out A X
#endnomacros

No macros are expanded between #nomacros and #endnomacros unless explicitly enabled by #in. No macros defined between #nomacros and #endnomacros will be defined after #endnomacros unless explicitly enabled by #out.

Suggestion by Bjarne Stroustrup. After discussion in the EWG it was decided to look for a solution that allowed macros used by macros allowed in by “#in” to be used in the expansion of such macros only.

#nomacros should nest.

e.tadeu