pointless uglification (was Re: gettext markup of library sources)

Nathan Myers ncm-nospam@cantrip.org
Mon Apr 21 20:47:00 GMT 2003


On Mon, Apr 21, 2003 at 12:53:49PM -0700, Ulrich Drepper wrote:
> Phil Edwards wrote:
> 
> >>Also, using __ prefexes in macro parameters is completely unnecessary.
> >>Those tokens are not in the normal namespace and therefore aren't
> >>polluting it.
> > 
> > If you mean, "they are macros, not types/variables/functions, therefore
> > the rules don't matter," the C++ standard does not make the distinction
> > when reserving the __* names. 
> 
> I'm talking about the parameter names.  I don't believe that even C++
> people can screw up the preprocessor definition enough for this not to
> be true.

Ulrich is right.  The "C++ people" haven't screwed up the preprocessor 
definition.  The namespace of macro formal arguments is disjoint from 
other namespaces, and (in particular) is not subject to clobbering by 
users' macros.  Therefore, there is no practical need to uglify 
macro-formal-argument names.

To be clear about this:

  // include/bits/foo.h
  #define _GCC_FOO(a)   !(a)    // good.
  #define _GCC_BAR(__a) !(__a)  // pointless obscurantism.

  // footest.cc
  #include <bits/foo.h>
  void foo() { _GCC_FOO(1); }

  gcc -Da='@#`' footest.cc   # OK

This principle extends even to names found in BADNAMES.

Nathan Myers
ncm-nospam@cantrip.org



More information about the Libstdc++ mailing list