 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Chris Hills Guest
|
Posted: Fri Nov 26, 2004 11:57 pm Post subject: C++ strye guide? |
|
|
Hi,
I have been asked by some one to recommend a C++ style guide. As 90% of
my work is in embedded C I thought I would ask here. Any suggestions?
| Quote: | I need a C++ style guide suitable for interfacing the high academic
community to a heads-down military system engineering types. I am
commisioning some research and some of the output is required as
portable ANSI C++ code. I need a style guide that I can mandate that
means non-mathematical engineering types can pick up and incorporate
the finished software as simply as possible.
Emphasis should be on portability, readability and clarity. Target
application is not embedded and could be found on Windows 2K+ and UNIX
(including MacOS X) platforms. The software is not safety critical
(heck, it may run on Windows), but any nods in that direction would be
useful.
Anything you can suggest?
|
//////////////////////////
//// Chris Hills Staffs England /////
/// [email]chris (AT) phaedsys (DOT) org[/email] www.phaedsys.org //
//////////////////////////
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Herb Sutter Guest
|
Posted: Sun Nov 28, 2004 11:38 am Post subject: Re: C++ strye guide? |
|
|
On 26 Nov 2004 18:57:09 -0500, Chris Hills <chris (AT) phaedsys (DOT) org> wrote:
| Quote: | I have been asked by some one to recommend a C++ style guide. As 90% of
my work is in embedded C I thought I would ask here. Any suggestions?
I need a C++ style guide suitable for interfacing the high academic
community to a heads-down military system engineering types. I am
commisioning some research and some of the output is required as
portable ANSI C++ code. I need a style guide that I can mandate that
means non-mathematical engineering types can pick up and incorporate
the finished software as simply as possible.
Emphasis should be on portability, readability and clarity. Target
application is not embedded and could be found on Windows 2K+ and UNIX
(including MacOS X) platforms. The software is not safety critical
(heck, it may run on Windows), but any nods in that direction would be
useful.
Anything you can suggest?
|
Most of this sounds like a perfect description of Andrei's and my new book
C++ Coding Standards ([url]www.gotw.ca/publications/c++cs.htm)[/url]. You can check
out a table of contents at that link, and also click on the Amazon link to
see the reviews there. (Here's a direct link to the Amazon customer
reviews:
http://www.amazon.com/gp/product/customer-reviews/0321113586/ref=cm_cr_dp_2_1/104-6856000-4134308?%5Fencoding=UTF8&customer-reviews.sort%5Fby=-S
ubmissionDate&n=283155
...)
Herb
---
Herb Sutter (www.gotw.ca) (www.pluralsight.com/blogs/hsutter)
Convener, ISO WG21 (C++ standards committee) (www.gotw.ca/iso)
Contributing editor, C/C++ Users Journal (www.gotw.ca/cuj)
Architect, Developer Division, Microsoft (www.gotw.ca/microsoft)
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Mickey Moore Guest
|
Posted: Sun Nov 28, 2004 11:56 pm Post subject: Re: C++ strye guide? |
|
|
| Quote: | I need a C++ style guide suitable for interfacing the high academic
community to a heads-down military system engineering types. I am
commisioning some research and some of the output is required as
portable ANSI C++ code. I need a style guide that I can mandate that
means non-mathematical engineering types can pick up and incorporate
the finished software as simply as possible.
Emphasis should be on portability, readability and clarity. Target
application is not embedded and could be found on Windows 2K+ and UNIX
(including MacOS X) platforms. The software is not safety critical
(heck, it may run on Windows), but any nods in that direction would be
useful.
Anything you can suggest?
Most of this sounds like a perfect description of Andrei's and my new book
C++ Coding Standards.
|
To someone outside the C++ community, it might sound as if he's just
promoting his own book, but he's one of the leading experts here and
it really is an excellent book that packs a lot of experience into a
condensed form (with abundant references if you need more details).
It's what I would've recommended, as it sounds like it fits your
needs perfectly.
-- Mickey Moore
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Bob Guest
|
Posted: Mon Nov 29, 2004 9:46 pm Post subject: Re: C++ strye guide? |
|
|
Chris Hills <chris (AT) phaedsys (DOT) org> wrote
| Quote: | Hi,
I have been asked by some one to recommend a C++ style guide. As 90% of
my work is in embedded C I thought I would ask here. Any suggestions?
I need a C++ style guide suitable for interfacing the high academic
community to a heads-down military system engineering types. I am
commisioning some research and some of the output is required as
portable ANSI C++ code. I need a style guide that I can mandate that
means non-mathematical engineering types can pick up and incorporate
the finished software as simply as possible.
Emphasis should be on portability, readability and clarity. Target
application is not embedded and could be found on Windows 2K+ and UNIX
(including MacOS X) platforms. The software is not safety critical
(heck, it may run on Windows), but any nods in that direction would be
useful.
Anything you can suggest?
//////////////////////////
//// Chris Hills Staffs England /////
/// [email]chris (AT) phaedsys (DOT) org[/email] www.phaedsys.org //
//////////////////////////
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
have you seen the standard on www.codingstandard.com? It's a c++
coding standard available online and covers everything listed you've
listed above.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Tim Rowe Guest
|
Posted: Mon Dec 20, 2004 12:50 am Post subject: Re: C++ strye guide? |
|
|
On 28 Nov 2004 18:56:04 -0500, Mickey Moore <mgmoore (AT) austin (DOT) rr.com>
wrote:
| Quote: | I need a C++ style guide suitable for interfacing the high academic
community to a heads-down military system engineering types. I am
commisioning some research and some of the output is required as
portable ANSI C++ code. I need a style guide that I can mandate that
means non-mathematical engineering types can pick up and incorporate
the finished software as simply as possible.
Emphasis should be on portability, readability and clarity. Target
application is not embedded and could be found on Windows 2K+ and UNIX
(including MacOS X) platforms. The software is not safety critical
(heck, it may run on Windows), but any nods in that direction would be
useful.
Anything you can suggest?
Most of this sounds like a perfect description of Andrei's and my new book
C++ Coding Standards.
To someone outside the C++ community, it might sound as if he's just
promoting his own book, but he's one of the leading experts here and
it really is an excellent book that packs a lot of experience into a
condensed form (with abundant references if you need more details).
It's what I would've recommended, as it sounds like it fits your
needs perfectly.
|
Seconded. But that book aims for a minimum baseline coding standard,
and IIRC (my copy is at work, I'm not) acknowledges that some
environments may need to add to it. Depending on what military
systems you're interfacing, the software may be mission critical
(although apparently not safety critical) and stricter coding
standards than would be appropriate for normal commercial development
may be appropriate for your development. Have you checked whether the
customer (or their regulator if they have one) have any coding
guidance? Since you ask for nods in the safety critical direction,
the best I know of for safety critical C is the MISRA guidelines. I
don't know anything to match that for C++, but apart from a very few
gotchas standard C /is/ standard C++ so you should be able to deliver
C and be compliant!
Replies to tim at digitig dot co dot uk
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Chris Hills Guest
|
Posted: Thu Dec 23, 2004 11:58 am Post subject: Re: C++ strye guide? |
|
|
In article <qb1cs0tht16o0fgi73d0rohggvjf88mm8m (AT) 4ax (DOT) com>, Tim Rowe
<clcppm-poster (AT) this (DOT) is.invalid> writes
| Quote: | guidance? Since you ask for nods in the safety critical direction,
the best I know of for safety critical C is the MISRA guidelines.
|
That's good to know.
| Quote: | I
don't know anything to match that for C++, but apart from a very few
gotchas standard C /is/ standard C++ so you should be able to deliver
C and be compliant!
|
No... c and C++ are different languages. C++ has diverged somewhat from
C since c90 . There are some attempts to remove the inconsistencies but
the C++ standards people want C to move closer to C++. IE where there
are changes to C++ they should also be in C. However, the C standards
people are saying if you want to harmonise C++ should become compatible
with C.
The problem is there are two types of users of C
1: The c/C++ users who are invariably PC based and think that C is a
suubset of C++, that ALL C compilers are really C++ compilers used in C
mode. These people tend to think that no one uses 16, let alone 8, bit
processors anymore.
2 the embedded community who often use C on platforms where there is no
C++ compiler and need (as opposed to want or would like) a small compact
and precise language. They don't need or require C/C++ compatibility.
As long as it does not add code blot or unrequited features to C they
don't mind what the C++ community does.
An impasse. It does not help that the majority of the Embedded C world
is still using C90. (well actually C95 with // comments)
Regards
Chris
//////////////////////////
//// Chris Hills Staffs England /////
/// [email]chris (AT) phaedsys (DOT) org[/email] www.phaedsys.org //
//////////////////////////
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Tim Rowe Guest
|
Posted: Mon Jan 03, 2005 12:38 am Post subject: Re: C++ strye guide? |
|
|
On 23 Dec 2004 06:58:00 -0500, Chris Hills <chris (AT) phaedsys (DOT) org> wrote:
| Quote: | In article <qb1cs0tht16o0fgi73d0rohggvjf88mm8m (AT) 4ax (DOT) com>, Tim Rowe
[email]clcppm-poster (AT) this (DOT) is.inva[/email]lid> writes
guidance? Since you ask for nods in the safety critical direction,
the best I know of for safety critical C is the MISRA guidelines.
That's good to know.
|
I should have said "safety-/related/ C", by the way, as (at least in
the terminology I am used to) safety-/critical/ is rather more
restrictive and C would be at best a questionable choice for
safety-/critical/. There are regular discussions hereabouts over
whether C has the technical capability to support safety-critical, but
even if it has there is still the problem of persuading the relevant
regulator!
| Quote: | I
don't know anything to match that for C++, but apart from a very few
gotchas standard C /is/ standard C++ so you should be able to deliver
C and be compliant!
No... c and C++ are different languages. C++ has diverged somewhat from
C since c90 .
|
Noted; I knew there was some divergence, but as I work in the safety
field folks tend to stay with the well-trodden paths so I may have
missed just how far some of the bits I don't touch have diverged. But
for just that reason, chances are that the C someone would be writing
if they were following the coding standards for safety-related
software /would/ be valid C++ (give or take the occasional identifier
clashing with a C++ keyword and the like) as such standards tend to
impose (or assume) a language subset. For example, the FAQ for MISRA
C [1] states "MISRA-C:2004 is based on the C language as defined by
ISO 9899:1990 (plus corrigenda). C99 has not been considered in
MISRA-C:2004 due to the limited support for C99 on embedded
microprocessors." -- as you say:
| Quote: | the majority of the Embedded C world is still using C90. (well actually C95 with // comments)
|
[1] http://www.misra.org.uk/
Replies to tim at digitig dot co dot uk
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|