The Rule of the Big Five

The dynamic creation and destruction of objects was always one of the bugbears of C.  It requires the programmer to manually control the allocation, initialisation and deallocation of memory for the object.  Because many C programmers weren’t educated in the potential problems (or were just plain lazy or delinquent in their programming) C got a reputation in some quarters for being an unsafe, memory-leaking language.

C++ improved matters significantly with an idiom known as RAII/RRID; more generically referred to as resource management.  Resource management frees the client from having to worry about the lifetime of the managed object, potentially eliminating memory leaks and other problems in C++ code.

However, introducing resource management can lead to potential problems, particularly if the ‘manager’ objects are passed around the system.  These problems led to the need for establishing a ‘copy policy’ for each of your types, sometimes referred to as ‘The Rule of the Big Three’.  C++11 further complicated this by introducing move semantics.  

This whitepaper explores the copy and move semantics of C++ and introduces a policy we call ‘The Rule of The Big Five’. 

Example source code for Visual Studio 2012 and GCC can be downloaded from GitHub:


Please click the link below to download the paper


Attachment Size
Rule of the Big Five.pdf 1.07 MB