4 ms·
I'm going to dissent on this. While the Core Guidelines "raise the floor" for code safety, I think the may be lowering/hardening the ceiling[1] as well. One pro
by duneroadrunner 9y ago
I'm going to dissent on this. While the Core Guidelines "raise the floor" for code safety, I think the may be lowering/hardening the ceiling[1] as well. One problem is that, they impose an (inflexible) standard for function interfaces that is still intrinsically unsafe. For example, they direct you to standardize on std::shared_ptr for objects shared between threads. But this prevents you from using (even) safer smart pointers that, for example, do automatic mutex locking[2].
Presumably the alternatives to a standardized, intrinsically unsafe interface are either a standardized, safe interface, which would require introducing safe alternatives for unsafe elements like std::shared_ptr and raw pointers. Or a more felixible interface standard. For example, making your public functions function templates when necessary.
[1] shameless plug: https://github.com/duneroadrunner/SaferCPlusPlus#safercplusplus-versus-the-core-guidelines-checkers https://github.com/duneroadrunner/SaferCPlusPlus#safercplusp...
[2] https://github.com/duneroadrunner/SaferCPlusPlus#the-problem-with-stdshared_ptr https://github.com/duneroadrunner/SaferCPlusPlus#the-problem...