C++ Coding Standards: 101 Rules, Guidelines, and Best Practices
by Herb Sutter, Andrei Alexandrescu
Type Safety
Trying to outsmart a compiler defeats much of the purpose of using one.
—Brian Kernighan & P.J. Plauger
If you lie to the compiler, it will get its revenge.
—Henry Spencer
There will always be things we wish to say in our programs that in all known languages can only be said poorly.
—Alan Perlis
Last, but certainly not least, we will consider type correctness—a very important property of a program that you should strive to preserve at all times. Theoretically, a type-correct function can never access untyped memory or return forged values. Practically, if your code maintains type soundness, it avoids a large category of nasty errors ranging from nonportability to corrupting memory to creating bogus values to exhibiting undefined ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access