https://gist.github.com/bkaradzic/2e39896bc7d8c34e042b
1. Exception handling is the only C++ language feature which requires significant support from a complex runtime system, and it's the only C++ feature that has a runtime cost even if you don't use it.
- Patently false. And soon there will be: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0709r0.pdf
Major compilers' exceptions are not gonna hit u unless u throw them, true for GCC @ least
2.
#include <stdio.h>
int main()
{
printf("hello, world\n");
return 0;
}
Using fmtlib, we've got our own formatting
fmt::print("Hello, world"); with better type checking and outstanding perf.
3. Don't use RTTI.
Perhaps one embedded dev or RTOS dev missed road. TBF, I haven't personally used this, but like every other "dreaded" feature some people/industry will find a use for it. I don't know why Locale isn't on your list tho.
4. Don't use C++ runtime wrapper for C runtime includes (<cstdio>, <cmath>, etc.), use C runtime instead (<stdio.h>, <math.h>, etc.)
Even when they come with constexpr included?
5. Don't use stream (<iostream>, <stringstream>, etc.), use printf style functions instead.
Ofcourse, that's why we have fmtlib
6. Don't use anything from STL that allocates memory, unless you don't care about memory management.
And that's why programmers are still writing:
for (int i = 0; i < strlen(s); ++i) { ... } till tomorrow
7. Don't use metaprogramming excessively for academic masturbation. Use it in moderation, only where necessary, and where it reduces code complexity.
This will age quickly as C++ get better facilities like Concepts. These guys never read proposals before masturbating GitHub themselves.
8. Wary of any features introduced in current standard C++, ideally wait for improvements of those feature in next iteration of standard. Example constexpr from C++11 became usable in C++14 (per Jason Turner cppbestpractices.com curator)
Only true for some features, plus constexpr was only limited NOT useless.