I know it makes little difference to a project but, assuming you use #defined header guards for your C++ code, what format do you use? e.g. assuming a header called foo.hpp
:
#ifndef __FOO_HPP__
...
#ifndef INCLUDED_FOO_HPP
...
#ifndef SOME_OTHER_FORMAT
I'm sold on the idea of upper-case #defines but cannot settle on a format for these guards.
I always use use
I always use
INCLUDED_FOO_HPP
I wouldn't use the double underscore one, because starting things with double underscores is reserved.
I tend to use:
(replace _H_ with the appropriate extension like _HPP_, etc). The date stamp is to avoid collisions with other same named headers in other directions/libraries.
so in the end it looks like this:
Personally, i just use the filename FOO_HPP. Google uses the whole path like SRC_ENGINE_FAST_HPP.
(
17.4.3.1.2/1
)If you are using Visual Studio or a Microsoft compiler use the pragma way
I use
or
Keeping it synchronous with folder hierarchies is too annoying (friend of refactoring), GUIDs are too annoying, the date suffix is good enough. If I would have to equally named files on the same day, I would