As per C++11 17.6.4.3.2 Global names
(though this restriction has been around for a while):
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 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.
So you really should be using neither if you want your software to be portable though, having said that, plenty of people do use both varieties.
It would be "safer" to use something like GUARD_X_H
or X_H_INCLUDED
though, of course, you still need to be wary of clashes. You might take the Java way and end up with macros like:
AU_COM_POWERFIELD_DATASTRUCTURES_TREES_BALANCED_BTREE_H
as long as you stay below the implementation limits for macro names (which, from memory, is at least 1024 characters).
Alternatively, if you want to sacrifice portability (but not much portability since it's supported in a great many compilers), you could look into #pragma once
, where you don't have to worry about coming up with unique names.