Hello,

I just wanted to mention an issue with our naming convention that goes
against the C++ standard due to the rules around reserved names.

>From N3797,

17.6.4.3 Reserved names [reserved.names]



 . . .



17.6.4.3.2 Global names [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 (2.12) is reserved to the
> implementation for any use. *



— *Each name that begins with an underscore is reserved to the
> implementation for use as a name in the global namespace.*


The biggest offender is the include guard since all of them start and end
with double underscores. A few other examples are *<stout/exit.hpp>*'s
*__Exit* struct, *src/zookeeper/zookeeper.cpp*'s *__create*,
*src/slave/containerizer/docker.cpp*'s *__launch*.

We use leading double underscore for internal implementation sometimes,
which I think should live in the *internal* namespace instead or have names
such as *createImpl* or *createHelper*.

In the case of *__launch*, we start out with *launch* then go onto
*_launch* (this
one is allowed because it's a member function and therefore not in the
global namespace and it started with an underscore but is not followed by
an uppercase letter.) then we get to *__launch* which is not allowed since
it contains a double underscore. We should probably give these kinds of
functions better names associated with their phase, or even just numbering
them would be ok. Changing them to be trailing underscores wouldn't help
much either since the rule around double underscores is *contains* rather
than *starts with*.

Anyway, practically speaking it hasn't been a big issue for us yet. It's
just something I noticed and thought should bring up to the group.

Thanks,

MPark

Reply via email to