[ILUG] C++ Coding Standards
Sonic
sonic at dreadserver.com
Thu Mar 29 23:54:07 IST 2007
On Thu, 29 Mar 2007 23:52:18 +0200, Brian Foster <blf at blf.utvinternet.ie> wrote:
> | Date: Thu, 29 Mar 2007 17:47:36 +0100
> | From: Sonic <sonic at dreadserver.com>
> |
> | Does anyone know of a preferred C++ coding standard [ ... ]
>
> the one and only coding standard I've used for years,
> everywhere, and with any language, is just three rules,
> listed from most to least important (i.e., the last
> rule applies first, and the first rule is used only
> as a last resort):
>
> 1. all reasonable exceptions are allowed.
>
> 2. anything the developer(s) and the reviewer(s)
> agree on is allowed.
>
> 3. follow the existing style.
>
> the critical point here is rule 2: if the people
> (and tools (when applicable)) who review the code
> are Ok with it, it's fine. security, functionality,
> maintainability, documentation, and (lack of) defects
> are vastly more important than how many spaces are
> used to indent.
>
It was more from the point of view of making life easier for people to code together. I'd like it so that when I read a variable name I'll know exactly what it's supposed to be. I'd like to be able to know straight away that somethingLikeThis is a variable set to the return value of a function and if it's SomethingLikeThis it's an object. The capitalization of the first letter here is important.
I'm just a stickler for detail though ;)
But good tip :)
Cheers,
Sonic
More information about the ILUG
mailing list