I'm looking for something to read on C++ style
One of the top results on google is http://geosoft.no/development/cppstyle.html
but I came accross this: "In general, the use of global variables should be avoided. Consider using singleton objects instead." and it makes me suspect...
I think styling is overrated. It helps when you're starting off because what you think might work really well will land you in trouble later on, so by all means read the literature, but I think you'll find most of those are written by people who really know what they're talking about, so I don't think any one of those would be "inferior". It might be wise to pick one that's in a similar field to that in which you'll be operating. For example, an engineering code that acts as a tool to find a solution to some problem would be optimised in a completely different way (namely for ease of understanding, versatility, ease of writing and ease of use) to a piece of code written for a computer game (very low level, strong focus on efficiency and speed, logical sequences are probably less of a priority than performance,etc.).
Other than that I wouldn't stress too much about it until you are required by an employer/client to write code in a particular way, in which case you'll probably have to adhere to a whole new set of rules anyway.
Thanks for the reply. I see what you mean, let me explain why I am curious.
I recently started learning how to code under GNU/Linux and it's a very different working environment from Visual Studio.
For instance I would prefer to define everything in headers in VS so that all definitions and declarations are in the same place by taking advantage of the 'collapse (ctrl-m-o)' outlining functionality I could navigate through 4k+ lines of code by navigating essentially a collapsed tree.
With gcc and the command line however I'm more inclined to want many compilation units.
As for syntax style I preferred functions or flow control looking like
1 2 3 4 5 6 7 8 9
foo( int arg ){
...
}
if( x == y ){
...
}
for( int i=0; i<max; ++i ){
...
}
I guess things like (x just look icky to me. I'd rather see the paren 'bound' to where it came from, not the helpless little variable 'x'.
Not putting the brace on a newline below the header is probably another result of using VS outlining.
It seems that K&R style is much more prevalent and I now have an impending job interview come up since starting this thread, wouldn't want to make any dreadful mistakes.
The Geosoft guide you linked is mostly useless. The JSF guide is pretty good until it falls in the same trap as Google C++ style guide, restricting the language to ensure compatibility with existing broken C++ code.