Include guards use reserved identifiers

Description

Ogre's include guards currently are of the form _File_H_, which means we are using identifiers that are reserved. See: http://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-a-c-identifier

Also, it would probably be better to prepend "OGRE_" to the include guards as well to reduce the risk of clashes with other libraries.

Proposed formats:
OGRE_FILE_H_INCLUDED ?
OGRE_FILE_H ?
OGRE_[COMPONENT]_FILE_H ?

Environment

None

Activity

Show:
M
October 19, 2013, 8:46 PM

I'd say let's hold off on this until 2.0. Simply because we're going to have some pretty intense merges leading up to it so let's not do anything to make it any more difficult.

Former user
October 19, 2013, 9:01 PM

Sounds good to me.

A. Joël Lamotte
January 5, 2014, 5:17 PM

I like the_INCLUDED one, should work well with COMPONENT too.
OGRE_[COMPONENT_]FILE_H_INCLUDED

In my own code I tend to use something like
PROJECT_[COMPONENT_]FILE_EXT__
The double underscore at the end is allowed by the standard and is good to avoid conflicts, but INCLUDED seems more useful in potential macro magic.

Matias Goldberg
March 3, 2015, 9:40 PM
Edited

I've using _NameSpaceNameOfFile_H_ for the new files I've been creating.
For example:
OgreMyFile.h --> _OgreMyFile_H_
PbsMaterialsGameState.h -> _Demo_PbsMaterialsGameState_H_ (see https://bitbucket.org/sinbad/ogre/src/e79178d0a233ac4d0e9906963f01fda674e4dac1/Samples/2.0/Showcase/PbsMaterials/PbsMaterialsGameState.h?at=v2-1)

It was in line with how it was working before, except without the double underscore start.

Matias Goldberg
March 3, 2015, 9:44 PM
Edited

I want to raise against header guards starting just with OGRE since it will clutter autocomplete (i.e. _OGRE is fine).

Assignee

Unassigned

Reporter

Former user

Labels

None

Components

Fix versions

Affects versions

Priority

Trivial
Configure