J
Jorgen Grahn
These aren't that weird if you're working on Unix, especially with older
code. The .cpp extension is actually the new one as I understand,
standardized for little or no more reason than that VS does it.
The only one I mind is .c++. Like Kanze elsewhere in the thread I
normally use .cc, and don't mind .C or .cpp.
Not bad advice actually. I personally don't go as far as to disallow
inline functions, but tending toward putting functions in implementation
files is a good idea. People strongly opposed are often under the
misconception that it actually makes a difference as far as whether
something can-be/is inlined by the compiler.
http://crazyeddiecpp.blogspot.com/2010/12/inline-functions-and-you.html
That article seems to be directed at people who slap "inline" onto
pretty much everything, and I guess that's a good thing ... but I find
myself disagreeing with most of it, and the link-time optimization he
promises turns out to be unusable in my environment.
Maybe the people you work with are the stupid ones (see how that
works?).
For the record, they're not (and neither were the ones who used 2).
Using 2 spaces is almost certainly the predominant view out
there. Most published standards use it. We use it here. AFAICT most
open source code uses it... There's really no reason for anything more.
2 is enough to make the indentation quite clear; nothing is gained with 4.
I do realize there's a wide amount of new developers who never outgrew
the VS defaults,
It's not just a VS default; None of the builtin styles in emacs use
two[0]. Only the old "ellemtel" style uses three; the others use four
or more. IIUC, the situation is the same in Eclipse.
but to call an opinion that doesn't actually effect
readability at all "stupid" is pretty fucking stupid.
It sure decreases readability for me, although not so much that it
becomes unreadable. If it doesn't for you, either your brain is
differently wired[1], or the code you're reading is well-designed
with a low nesting level and short blocks.
And if they commonly switch from Java to C++ and back, this makes some
amount of sense.
For use within that organization perhaps. Part of the problem with the
document is that it doesn't explicitly say who the target audience is.
Many of the seemingly crazy rules may make sense internally.
/Jorgen
[0] The "gnu" mode says 2, but it's really 2+2, with the funny
intermediate column they reserve for brackets.
[1] We have proven in this thread that different brains /are/
differently wired. ;-)