It's easy to forget that alignment is important on some architectures (other than for performance reasons), so be careful when using placement new: https://www.securecoding.cert.org/confluence/display/cpluspl...
This may seem obvious, but even the C++ committee got this one wrong when they created auto_ptr (which has since been removed from the standard): https://www.securecoding.cert.org/confluence/display/cpluspl...
This one is totally obvious but has a stunning number of ways you can fail to adhere to it, some of which look reasonable at first blush: https://www.securecoding.cert.org/confluence/display/cpluspl...
If memory safety is actually important to you, there's now an actual practical solution: SaferCPlusPlus[1].
A tool to automatically retrofit memory safety to existing C/C++ code is in early development (but resources are limited so it might be a while).
[1] shameless plug: https://github.com/duneroadrunner/SaferCPlusPlus
If memory safety is actually important to you, there's now an actual practical solution: SaferCPlusPlus[1].
A tool to automatically retrofit memory safety to existing C/C++ code is in early development (but resources are limited so it might be a while).
[1] shameless plug: https://github.com/duneroadrunner/SaferCPlusPlus