C++ coding standards

D

dom.k.black

Can anyone recommend a good existing C++ coding standard - parctical,
pragmatic and sensible?

A company I joined recently are moving from C to C++, they are very
much into coding standards. But I have a horibble feeling they might
get a C programmer to write the C++ standard. Would be nice to be able
to suggest an existing standard.
 
D

dave_mikesell

Can anyone recommend a good existing C++ coding standard - parctical,
pragmatic and sensible?

A company I joined recently are moving from C to C++, they are very
much into coding standards. But I have a horibble feeling they might
get a C programmer to write the C++ standard. Would be nice to be able
to suggest an existing standard.

No, but just a bit of advice to keep the "style" section to a
minimum. You can download and integrate a source code formatter (like
SourceFormatX) into your build stream that will format the code
according to your preference. Concentrate more on best practices. I
don't care what the name of the function is or where you put the curly
brace if it returns a dangling pointer.
 
M

Maarten Kronenburg

wrote in message
Can anyone recommend a good existing C++ coding standard - parctical,
pragmatic and sensible?

A company I joined recently are moving from C to C++, they are very
much into coding standards. But I have a horibble feeling they might
get a C programmer to write the C++ standard. Would be nice to be able
to suggest an existing standard.

There is the book "C++ Coding Standards" by Sutter and Alexandrescu.
 
D

dom.k.black

No, but just a bit of advice to keep the "style" section to a
minimum. You can download and integrate a source code formatter (like
SourceFormatX) into your build stream that will format the code
according to your preference. Concentrate more on best practices. I
don't care what the name of the function is or where you put the curly
brace if it returns a dangling pointer.

I totally agree, but I would rather steer clear of defining it myself
at all :)

There are always arguments with this sort of stuff, often personal
opinion or religious, often pointless. And to be honest I am not so
arrogant as to assume that I can do a better job of it than others who
might have spent a lot more time on it than I have available.

So a third party standard would suit me fine. No doubt there will
still be discussions and tinkering.
 
D

dom.k.black

wrote in message


There is the book "C++ Coding Standards" by Sutter and Alexandrescu.

There was another book I heard of, 101 tips or something similar.

Are these worth investing in?
 
M

Martin Moene

Maarten said:
wrote in message

There is the book "C++ Coding Standards" by Sutter and Alexandrescu.

Other coding standards are:

* Industrial Strength C++,
http://hem.passagen.se/erinyq/industrial/

* High-Integrity C++ Manual, can be requested from:
http://www.codingstandard.com/

* Joint Strike Fighter Air Vehicle C++ Coding Standards,
http://www.research.att.com/~bs/JSF-AV-rules.pdf

* Coding Standard: C#" - Philips Medical Systems,
http://www.tiobe.com/standards/gemrcsharpcs.pdf

Martin.
 
M

Martin Moene

Maarten said:
wrote in message

There is the book "C++ Coding Standards" by Sutter and Alexandrescu.

Other coding standards are:

* Industrial Strength C++,
http://hem.passagen.se/erinyq/industrial/

* High-Integrity C++ Manual, can be requested from:
http://www.codingstandard.com/

* Joint Strike Fighter Air Vehicle C++ Coding Standards,
http://www.research.att.com/~bs/JSF-AV-rules.pdf

* Coding Standard: C#" - Philips Medical Systems,
http://www.tiobe.com/standards/gemrcsharpcs.pdf

Martin.
 
M

Maarten Kronenburg

wrote in message
There was another book I heard of, 101 tips or something similar.

Are these worth investing in?

The subtitle of the book I mentioned is:
"101 Rules, Guidelines, and Best Practices"
so probably it's the same book.
Yes I think this book is worth buying.
For good C++ source code you may also use templates, STL containers and
design patterns.
In the same series there is "Modern C++ design" by Alexandrescu and "C++
Template Metaprogramming" by Abrahams and Gurtovoy.
 
Y

Yannick Tremblay

There was another book I heard of, 101 tips or something similar.

Are these worth investing in?

IMO, you could do a lot worse than buying a copy of this
book. (Actually the company should buy the copy of the book for the
pricely sum of about 1 hours of developper time), read through it,
select the ones you agree with (hopefully most), delete the ones you
disagree, maybe ignore the ones that are irrelevant to your situation,
and publish your own standard built upon this solid base
adding your own favourite one for local flavour and placing the book
in the public company bookshelf for reference and longer explaination
of some guidelines.

Yan
 
I

Ian Collins

Can anyone recommend a good existing C++ coding standard - parctical,
pragmatic and sensible?

A company I joined recently are moving from C to C++, they are very
much into coding standards. But I have a horibble feeling they might
get a C programmer to write the C++ standard. Would be nice to be able
to suggest an existing standard.

The whole team should devise the coding standard.

I wrote one for my last company, but we dumped it in favour of what
ended up as a best practice page on our team wiki. Too many coding
standards go into way too much detail, with section on indentation,
brace placement and other trivia. Let the team decide as they share
code what works for them, if you have rules, make them editor or pretty
print ones that can be kept up to date.
 
3

322322

The whole team should devise the coding standard.

I wrote one for my last company, but we dumped it in favour of what
ended up as a best practice page on our team wiki. Too many coding
standards go into way too much detail, with section on indentation,
brace placement and other trivia. Let the team decide as they share
code what works for them, if you have rules, make them editor or pretty
print ones that can be kept up to date.

The c++ Programming Languange
 
D

Default User

Ian said:
The whole team should devise the coding standard.

I wrote one for my last company, but we dumped it in favour of what
ended up as a best practice page on our team wiki.

Here, we had a group of representatives from the major projects using
C++ (inaptly named "The C++ Users Group) to work on the coding standard.
Too many coding
standards go into way too much detail, with section on indentation,
brace placement and other trivia. Let the team decide as they share
code what works for them, if you have rules, make them editor or
pretty print ones that can be kept up to date.

I strongly disagree with this. It's best to bite the bullet on those
things upfront, or it's a continual battle all through the project.




Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top