473,320 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Coding standard

Hi all:

I don't know if this is the best newsgroup to ask for this question, but
I don't find other.

I want to know about C++ Coding Standards and tools for verifing the code.

Thanks in advance.
Jul 19 '06 #1
7 1861
Carlos Martinez wrote:
I don't know if this is the best newsgroup to ask for this question, but
I don't find other.

I want to know about C++ Coding Standards and tools for verifing the code.
You might be interested in Sutter and Alexandrescu's _C++ Coding
Standards_. As for tools, I have used PC-Lint with some success (it's
not perfect, but it is quite useful). It doesn't allow customization
except by turning off certain messages, but it does support several
"standards" such as Scott Meyers' advice in _Effective C++_.

Cheers! --M

Jul 19 '06 #2
Carlos Martinez wrote:
I don't know if this is the best newsgroup to ask for this question,
but I don't find other.

I want to know about C++ Coding Standards and tools for verifing the
code.
C++ Coding Standards: http://www.gotw.ca/publications/c++cs.htm

Tools: http://www.google.com

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jul 19 '06 #3
Carlos Martinez wrote:
>I don't know if this is the best newsgroup to ask for this question, but
I don't find other.
I want to know about C++ Coding Standards and tools for verifing the code.
See:

http://www.research.att.com/~bs/JSF-AV-rules.pdf
http://hem.passagen.se/erinyq/industrial/
With respect to verification tools, Gimpel's pc-lint is the only
affordable one I know.

Roberto Waltman

[ Please reply to the group,
return address is invalid ]
Jul 19 '06 #4
Roberto Waltman wrote:
>See:

http://www.research.att.com/~bs/JSF-AV-rules.pdf
http://hem.passagen.se/erinyq/industrial/
Forgot this one: http://www.codingstandard.com/HICPPCM/index.html

Roberto Waltman

[ Please reply to the group,
return address is invalid ]
Jul 19 '06 #5
Roberto Waltman wrote:
Forgot this one: http://www.codingstandard.com/HICPPCM/index.html
I like the one that goes "never write a line of code without a failing test
case".

Specifically, the very first line I read in HICPPCM sez:

"Ensure all constructors supply an initial value (or invoke a constructor)
for each virtual base class, each non virtual base class and all non-static
data members."

Regardless of the wisdom of repeating the name of base classes, if they take
no arguments, that rule could be misconstrued to mean "supply every link to
other objects, that your object needs, in the constructor."

I know it doesn't say that. It should say "a constructor must do the minimum
to allow its destructor to call safely."

Test cases sometimes require you to construct an object _without_ its
navigable links to other objects. So the object should supply Set() or
Init() methods to then populate these objects, and it should work
well-enough without them.

I'm not sure why "An abstract class shall have no public constructors."

The point is that automated tests change these rules, and force you to obey
some of these rules.

And rules like "Use public derivation only" are flat-out wrong.

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Jul 19 '06 #6
Roberto Waltman <us****@rwaltman.netwrites:
Carlos Martinez wrote:
I don't know if this is the best newsgroup to ask for this question, but
I don't find other.
I want to know about C++ Coding Standards and tools for verifing the code.

See:

http://www.research.att.com/~bs/JSF-AV-rules.pdf
http://hem.passagen.se/erinyq/industrial/
With respect to verification tools, Gimpel's pc-lint is the only
affordable one I know.
Run, do not walk, to <http://valgrind.org/>. It's free, looks for
memory leaks and other bad behavior, can also do a lot of profiling,
and their customer support is orders of magnitude better than any
similar commercial product we've ever tried.

Unfortunately the platforms are limited to (I think) Linux on a few
popular hardware platforms.

----------------------------------------------------------------------
Dave Steffen, Ph.D.
Software Engineer IV Disobey this command!
Numerica Corporation
ph (970) 419-8343 x27
fax (970) 223-6797 - Douglas Hofstadter
dgsteffen at numerica dot us
Jul 19 '06 #7

Roberto Waltman wrote:
/
>
Forgot this one: http://www.codingstandard.com/HICPPCM/index.html
what is this standard about:

Rule 3.3.4 Avoid casting to a virtual base class as this is
irreversible.
(QA C++ 3071)

Justification
Do not cast a pointer up an inheritance hierarchy to a virtual base
class as this pointer may not be cast back down the hierarchy.

class A {};

class B : public virtual A {};

A* foo()
{
B* b = new B;
return static_cast< A* >( b ); // casting to virtual
base
}

Reference ISO C++ 5.2.9/5, 5.2.9/8;
===========================================

As B is an A why else would you inherit from A (virtual or otherwise)
if you can't cast your pointer to an A? And it isn't irreversible, I
have reversed the cast, but most of the time you don't want to cast the
other way anyway.

I don't have the ISO standard so what exactly do those two paragraphs
state?

Jul 20 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Mikkel christensen | last post by:
Hi there I wonder if any of you could point me in a direction where I can find some usefull information about coding standarts. I have some generel experiense in programming but I lack many...
144
by: Natt Serrasalmus | last post by:
After years of operating without any coding standards whatsoever, the company that I recently started working for has decided that it might be a good idea to have some. I'm involved in this...
13
by: benben | last post by:
Is there an effort to unify the c++ coding standard? Especially identifier naming. Not a big issue but it would be annoying to have to incorporate different coding styles simultaneously when...
50
by: Konrad Palczynski | last post by:
I am looking for tool to validate conformity to defined coding standard. I have already found Parasoft's C++ Test, but it is quite expensive. Is there any Open Source alternative? I do not need...
7
by: Robert Seacord | last post by:
The CERT/CC has just deployed a new web site dedicated to developing secure coding standards for the C programming language, C++, and eventually other programming language. We have already...
4
by: steven.sagerian | last post by:
Can anyone suggest a good off the shelf coding standard for embedded real time applications? Thanks, Steve
0
by: pat | last post by:
CodeCheck Coding Standard's Support As a free service to our customers we offer support in developing "rule-files" for automating corporate coding standards. If you have a coding standard that...
8
by: =?ISO-8859-1?Q?Arnaud_Carr=E9?= | last post by:
Hi all, I guess you all know how difficult it is to choose a conding standard. And even more difficult it is to explain the choice to your dev team :-) I'm looking for an "official" c++ coding...
19
by: auratius | last post by:
http://www.auratius.co.za/CSharpCodingStandards.html Complete CSharp Coding Standards 1. Naming Conventions and Styles 2. Coding Practices 3. Project Settings and Project Structure 4....
9
by: dom.k.black | last post by:
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.