ABRAXAS SOFTWARE - CodeCheck - Meyers: Effective C++ C++ Test-Suite .

Abraxas/Meyers: Effective C++  Home  Table of Contents  Meyers: Effective C++  

CodeCheck Rule-Files for Meyers: Effective C++ - C++ mec-test.ccp


//Item 2: Prefer consts, enums, and inlines to #defines. 13

//#include "mec.h"

Meyers: Effective C++ - CC++ Function Definition: m2

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


Item 3: Use const whenever possible. 17

Meyers: Effective C++ - CC++ Function Definition: m3

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


Item 4: Make sure that objects are initialized before they’re used. 26

Meyers: Effective C++ - CC++ Function Definition: m4

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


Item 5: Know what functions C++ silently writes and calls. 34

// bad 5, assumes all defaults

// good 5

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


// Item 6: Explicitly disallow the use of compiler-generated functions you do not want. 37

Meyers: Effective C++ - CC++ Function Definition: m6

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


// Item 7: Declare destructors virtual in polymorphic base classes. pg-40

Meyers: Effective C++ - CC++ Function Definition: m7
Meyers: Effective C++ - CC++ Function Definition: Time1
Meyers: Effective C++ - CC++ Function Definition: Time1
Meyers: Effective C++ - CC++ Function Definition: m7a

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


// Item 8: Prevent exceptions from leaving destructors. 44

Meyers: Effective C++ - CC++ Function Definition: Widget

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


// Item 9: Never call virtual functions during construction or destruction. 48

Meyers: Effective C++ - CC++ Function Definition: Trans

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


// Item 10: Have assignment operators return a reference to *this. 52

Meyers: Effective C++ - CC++ Function Definition: operator=
Meyers: Effective C++ - CC++ Function Definition: operator=

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


// Item 11: Handle assignment to self in operator=. 53

Meyers: Effective C++ - CC++ Function Definition: operator=

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


// Item 12: Copy all parts of an object. 57

Meyers: Effective C++ - CC++ Function Definition: operator=
Meyers: Effective C++ - CC++ Function Definition: operator=

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


// Item 13: Use objects to manage resources. 61

Meyers: Effective C++ - CC++ Function Definition: f

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


// Item 14: Think carefully about copying behavior in resource-managing classes. 66

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


// Item 15: Provide access to raw resources in resource-managing classes. 69

Meyers: Effective C++ - CC++ Function Definition: operator_class_FH
Meyers: Effective C++ - CC++ Function Definition: get

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


// Item 16: Use the same form in corresponding uses of new and delete. 73

Meyers: Effective C++ - CC++ Function Definition: m16
Meyers: Effective C++ - CC++ Function Definition: foo

//new (int(*p)) int; // new-placement expression

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


// Item 17: Store newed objects in smart pointers in standalone statements. 75

// keep it simple, no headers, just a simple fwd decl for the shared_ptr ...

Meyers: Effective C++ - CC++ Function Definition: pWidget

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


// Item 18: Make interfaces easy to use correctly and hard to use incorrectly. 78

Meyers: Effective C++ - CC++ Function Definition: M
Meyers: Effective C++ - CC++ Function Definition: D
Meyers: Effective C++ - CC++ Function Definition: Y

// bad

Meyers: Effective C++ - CC++ Function Definition: M
Meyers: Effective C++ - CC++ Function Definition: D
Meyers: Effective C++ - CC++ Function Definition: Y

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


// Item 19: Treat class design as type design. 84

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


// Item 20: Prefer pass-by-reference-to-const to pass-by-value. 86

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


// Item 21: Don’t try to return a reference when you must return an object. 90

Meyers: Effective C++ - CC++ Function Definition: validateStudent

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


// Item 22: Declare data members private. 94

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


// Item 23: Prefer non-member non-friend functions to member functions. 98

Meyers: Effective C++ - CC++ Function Definition: clear
Meyers: Effective C++ - CC++ Function Definition: clear

// namespace solution in source follows

Meyers: Effective C++ - CC++ Function Definition: clear

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


// Item 24: Declare non-member functions when type conversions should apply to all parameters. 102

Meyers: Effective C++ - CC++ Function Definition: operator*
Meyers: Effective C++ - CC++ Function Definition: operator*

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


// Item 25: Consider support for a non-throwing swap. 106

// ... overloading std ... rule 25

Meyers: Effective C++ - CC++ Function Definition: swap
Meyers: Effective C++ - CC++ Function Definition: swap

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


// Item 26: Postpone variable definitions as long as possible. 113

Meyers: Effective C++ - CC++ Function Definition: validateStudent

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++


Abraxas/Meyers: Effective C++  Home  Table of Contents  Meyers: Effective C++   

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++ Test-Suite Meyers: Effective C++