General Important Points: C++ Coding Standards and Best Practices
General Important Points: C++ Coding Standards and Best Practices
(Source: http://web.mit.edu/6.s096/www/standards.html)
Classes in C++
Follow the rule of three. If your class needs a non-trivial destructor, you should also
either implement or disable the copy constructor and copy assignment operators.
(furthermore, if you want your data to have the ability to be moved cheaply, also
define the move constructor and move assignment)
Don't use global data. Instead, encapsulate it in a class and design your interfaces
effectively.
Other
Do take advantage of the standard template library. Generally don't try to rewrite
data structures and algorithms that have already been implemented well in the
standard library unless you have a good reason.