Despite those "studies" I prefer to have the opening bracket on the same line. I don't know who "Allman" is and frankly, I don't really care what some people think is readable and what not. To me, having the opening bracket on the same line is a lot easier to read.
As for this piece of code found in Hybrid's link....
Code:
public:
/**
* Get the speed of the car
*
* @return speed in miles per hour.
*/
const float getSpeed();
/**
* Set the speed of the car
*
* @param pSpeed new speed of the car.
*/
void setSpeed(const float pSpeed);
...
I think it's definetly not something I could "show my mama". It's overloaded with comments. It's like not finding the wood because of all the trees.
I try not to use any comments "in" the code unless its a comment about an entire code-block. I prefer to have comments about a single function like the above ones behind the function, starting at column 60 if possible.
btw, how do you wrap long parameterlists ? Like this ?
Code:
// use glu to build mipmaps
gluBuild2DMipmaps(
GL_TEXTURE_2D,
oImage.iChannelCount, // must be 3 or 4, 4 for RGBA mode
oImage.iSizeX,
oImage.iSizeY,
iTexMode, // rgb or rgba textures
GL_UNSIGNED_BYTE, // subpixel datatype
oImage.pbData
);
Thats how I normally do it and it's analog to the way I use the curly brackets.