C ++ - style code

google code style

1. Safety dispenser (allocator), as scoped_ptr, scoped_array

2. testing, the other can not be used:

  2.1 Friend

  2.2 C ++ abnormal

  2.3 RTTI

3. type conversion, do not use (int)

  3.1 static_cast

  3.2 const_cast

  3.3 reinterpret_cast

  3.4 dynamic_cast

4. flow for the log, other do not use (because it is easy using the wrong type)

5. Use the assertion declare a variable, not unsigned

6. A STL, for functor (functors) and characteristics (a traits) class can not be used struct. Other all with class

 

7. Class

7.1 class has virtual member functions as virtual destructor. (?)

7.2 & overloaded operators forward declaration of the class can not be

7.3 Try not overloaded, but with equals (), copyFrom () and other alternative

7.4 functor class

 

problem:

1.

Guess you like

Origin www.cnblogs.com/yrm1160029237/p/11321031.html