logo slogan

High Integrity C++

Hi Integrity C++

After the first release of MISRA-C, PRQA realized there was an opportunity to formalize a high quality, peer reviewed collection of coding guidelines and best practices for C++.

 

So, PRQA began to gather rules, guidelines, and best practices for C++ and it's C subset from a wide variety of sources. Then, PRQA triaged them using their own extensive C++ language expertise, the PRQA coding standard domain experience, and their work with the ISO/IEC International Standard 14882.

Plus, PRQA referenced the works of well known C++ development experts

[Stroustrup, 2000]

Bjarne Stroustrup: The C++ Programming Language. Addison-Wesley. 2000

[C++ Standard, 1999]

International Standard ISO/IEC 14882:1998(E) Programming Language C++.

[Effective C++, 1996]

Scott Meyers: Effective C++. Addison-Wesley. 1996

[More Effective C++, 1996]

Scott Meyers: More Effective C++. Addison-Wesley. 1996

[Effective STL, 2001]

Scott Meyers: Effective STL. Addison-Wesley. 2001

[Industrial Strength C++, 1997]

Mats Henricson, Erik Nyquist, Ellemtel Utvecklings AB: Industrial Strength C++. Prentice Hall. 1997

[Exceptional C++, 2000]

Herb Sutter: Exceptional C++, Addison-Wesley. 2000

 

 

HIGH·INTEGRITY C++ was born—a coding standard that embodies best practices for developing high quality C++ code in multiple domains.

More than 15,000 copies of HIGH·INTEGRITY C++ have been downloaded from www.codingstandard.com to-date and it's broad appeal continues to grow.

Recently, HIGH·INTEGRITY C++ (also known as "HICPP") was a key reference document for MISRA-C++. And, third-parties are now offering enforcement modules. Of course, you'll find that our QA·HICPP compliance analyzer is best.

 

Overview

 

As a multi-paradigm language, C++ is used in a wide variety of domains—from safety critical systems to GUI applications.  Therefore, when designing a coding standard, it is possible to target an infinite set of domains resulting in an infinite set of rules.

 

So, PRQA decided that HIGH·INTEGRITY C++ should target best practice rules that covered any domain. We focused primarily on issues relating to problems with the language, but more significantly, to provide guidance to developers on the right way to solve problems at a higher level—rather than just targeting specific edge case constructs that the majority of developers will never need to use.  For example, rules on patterns help reduce the need for lots of specific rules relating to such edge cases.

 

A good example of such a pattern rule is the "no-fail" swap rule relating to the copy assignment operator:

class A
{
public:
  A (A const & rhs);
  void swap (A & lhs, A & rhs) throw ();

  A & operator= (A const & rhs)
  {
     A tmp (rhs);
    swap (*this, tmp);
    return *this;
  }

private:
  // ...
};

The above copy assignment operator is implemented using the no-fail swap idiom.  This pattern removes the requirement to protect against self assignment, it provides the “Strong Exception Guarantee” and finally it simplifies the entire implementation.  Enforcing such a pattern on the copy assignment operator therefore removes the need for many other lower level rules.