3 ms·
Honestly, writing safe C++ code means just following a few rules of thumb. Most importantly: never do pointer arithmetic, always use smart pointers. Basically,
by nhaehnle 13y ago
Honestly, writing safe C++ code means just following a few rules of thumb. Most importantly: never do pointer arithmetic, always use smart pointers.
Basically, 99% of your work should use only about 10% of the feature set of C++ explicitly. The vast majority of the time, you shouldn't even write templates (just use the ones in the STL and project-specific ones that make sense).
But it's really nice that those other 90% of features are there when you need them.
- jbeja 13y agoTheir should be a guide about how to write modern and unclutered C++ without the 90% of it.
- gpvos 13y ago"C++: The Good Parts"
- jejones3141 13y agoAnd a compiler that only accepts the 10%.
- nly 13y agoYour 10% is going to be different to my 10%. Almost all the C++ code I write includes new templates. Almost none of it includes inheritance. I rarely use smart pointers that aren't implementation details (private class members)