This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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 at cantrip dot org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]