I'd like to settle the placement of member variables (attributes) inside a class definition.
Currently, it's agreed to do it "like it's done in OGRE headers", but that's ambiguous. Most files put attributes on the bottom of the class def, but some put it right after the "private" or "protected" keyword, which is often somewhere in the middle of a file. That's annoying because (unless you're using symbol browser, which I don't) it's hard to locate, one has to slowly scroll the file to find it. Attributes on the top or bottom of the file are found easily.
I prefer for the attribute defs to be placed on top, i.e:
// == Attributes ==
// == Methods ==
void setSpeed(float speed);
Another thing I just came across:
Let's never use the "using namespace" declaration outside of a block. Let's use
/* code here */
using namespace ABCD;
/* code here */
} // The namespace is returned to previous state.
The problem with "using namespace" is: After it's declared globally in one file, it affects all subsequentially included files. So, ott3d classes with same name as library classes give problems. Example:
/home/an00bis/codeblocks/ott3d/ott3d/TerrainManager.h|14|error: reference to 'ConfigFile' is ambiguous|
/home/an00bis/codeblocks/ott3d/ott3d/ConfigFile.h|30|error: candidates are: class ConfigFile|
/home/an00bis/include/OgreMain/OgreConfigFile.h|57|error: class Ogre::ConfigFile|
||=== Build finished: 50 errors, 0 warnings ===|
Namespaces are designed to avoid clashes between app code and lib code. Mixing app with lib's namespace beats their purpose. Let's avoid it.