[MECpp]Item-4 Avoid Gratuitous Default Constructors
· โ˜• 5 min read

Including meaningless default constructors affects the efficiency of classes, so avoiding them in classes guarantees fully-initialized objects, with the cost of some limits on how such classes can be used.


[MECpp]Item-1 Distinguish Between Pointers and References
· โ˜• 3 min read

More effective C++: Use references when we already have something to refer to and never want to refer to anything else, or when implementing operators whose syntactic requires us to do so.


Item-52 Write placement delete if you write placement new
· โ˜• 5 min read

When we write a placement version of operator new, be sure to write the corresponding placement version of operator delete to avoid subtle, intermittent memory leaks. When we do so, pay attention not to unintentionally hide the normal versions of new and delete


Item-51 Adhere to convention when writing new and delete
· โ˜• 4 min read

operator new should contain an infinite loop trying to allocate memory, should call the new-handler if it can’t satisfy a memory request, and should handle requests for zero bytes; class-specific versions should handle requests for larger blocks than expected. operator delete should do nothing if passed a pointer that is null; class specific versions should handle blocks that are larger than expected.