Package Index  Table of Contents

Abraxas Software [ HOME ]

 “The Elements of C++ Style" [ overview ]

Abraxas Software (C) Copyright 2005 - Rule-File Code


 

 CodeCheck Rule-File for "The Elements of C++ Style" - ECS - Misfeldt, Bumgardner, Gray

 

 

  ECS: "Elements of C++ Style" - This rule file can be applied to C or C++

 

 

Use of this rule-file assumes that you have bought the book!

GOTO www.amazon.com & buy the book!

 

  

  To download the FREE ECS DEMO PACKAGE CLICK HERE LINUX WINDOWS

 

Below are the test suites for the ECS standard. Coding Example’s clearly show an example of the standard, and offer a test suite to validate that the codecheck rule-file script [ ecs.cc ] is automating the detection of violations of the standard.

We support ALL operating systems, and ALL C & C++ compilers. The default free examples are for Windows using MSDEV 6/7 and Linux using gcc. If you use another OS or another compiler contact us directly. [ support@abxsoft.com ]

Use of the CodeCheck rule file is ….

1.)   Windows [ msdev 6 – “vcvars32.bat” … msdev 7 – “vsvars32.bat”       ]

Chkdemo –k7 –Recs yourfile.cpp

2.)   Linux [ see how to gcc @ www.abxsoft.com/how-to-gcc.txt ]

Ccdemo linux.ccp gcc_nnn_cpp.ccp yourfile.cpp -Recs

 

 

 

C/C++ to HTML for Project - *.cpp



Module - 10.html


// test


Module - 11.html



Module - 12.html



Module - 126.html


126. Use C++ streams instead of stdio functions for type safety.

 
Function Definition: main

// don't use stdio.h

// good




Module - 145.html

 



145.  Avoid break and continue in iteration statements.

 
Function Definition: main

      // Avoid break and continue in iteration statements.




Module - 146.html

 



146.  Avoid multiple return statements in functions.

 
Function Definition: main



Module - 147.html

 



147.  Do not use goto.

 
Function Definition: main

//Do not use goto.




Module - 15.html

 



//15.    Pluralize the names of collections.




Module - 22.html

 



22.    Name all function parameters.

 
Function Definition: myclass



Module - 23.html

 



23.    Use "other" for parameter names in copy constructors and assignment operators.




Module - 27.html

 






Module - 28.html

 



// 28.  Avoid excessively long names.




Module - 40.html

 



40.    Use one-line comments to explain implementation details.

// comment about the function

 
Function Definition: f

// comment about the next aggregate statement

 
Function Definition: ff



Module - 42.html

 



42.   Provide a summary description of every declared element.

//GOOD foo doesn't do much




Module - 43.html

 



43.   Document the interface exposed by every function.

// foo does this ..

 
Function Definition: foo
 
Function Definition: badfoo



Module - 52.html

 



52.    Label closing braces in highly nested control structure.

// BAD

 
Function Definition: foo1

// GOOD

 
Function Definition: foo2



Module - 64.html

 



 
Function Definition: Thread



Module - 72.html

 






Module - 75.html

 



75.    Use portable types for portable code.

// bad over-riding #include

   will generate the above for you automatically this make's portable code!

  It's best to #include  and then let your compiler create the types for you.




Module - 76.html

 



76.    Use typedefs to simplify complicated type expressions.

 
Function Definition: bad
 
Function Definition: good



Module - 77.html

 



77.   Create a zero-valued enumerator to indicate an uninitialized, invalid, unspecified, or default state.

 // zero value, added zero intialization as comment

   // bad NO Default, or None, ...

// false positive exclusion




Module - 78.html

 



78.    Do not define enumerations using macros or integer constants.

// BAD don't use macro constants, use enum

// BAD also ..




Module - 79.html

 



79.   Declare enumerations within a namespace or class.

// bad, global space

// good nmsp

// good class space




Module - 80.html

 



80.   Declare global functions, variables, or constants as static members of a class.

// bad, should be static in class

  // good




Module - 9.html

 



9.       Include white space.

 
Function Definition: main


Module - gen.html

 


 
Function Definition: Foofun


Package Index  Table of Contents