Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 2001-06-22 17:40:28


From: <rwgk_at_[hidden]>
> In the header file boost/utility.hpp, leading underscores are
> are used for some variable names:
>
> template <class A, class B>
> class tied {
> public:
> inline tied(A& a, B& b) : _a(a), _b(b) { }
> /...
> protected:
> A& _a;
> B& _b;
> };
>
> I always thought that identifiers with leading underscores
> should not be used. Is this only true for identifieres
> in the global namespace?

The safe rule is not to use leading underscores, although I
think those above are technically OK, if useless.

17.4.3.1.2 Global names [lib.global.names]

1 Certain sets of names and function signatures are always reserved to
  the implementation:

  --Each name that contains a double underscore __) or begins with an
    underscore followed by an uppercase letter (_lex.key_) is reserved
    to the implementation for any use.

  --Each name that begins with an underscore is reserved to the imple-
    mentation for use as a name in the global namespace.22)

  _________________________
  22) Such names are also reserved in namespace ::std (_lib.re-
  served.names_).


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk