3 ms·
Compilers already break old code. If you specify e.g. -std=c99, you can't omit function return type, or declare argument types like in old C. Ideally, you'd ad
by anon4 11y ago
Compilers already break old code. If you specify e.g. -std=c99, you can't omit function return type, or declare argument types like in old C.
Ideally, you'd add these as feature flags to the compiler. So me and my team can decide "0 is not a pointer in our code", so we compile with -f0-is-not-a-ptr and with -fdefault-initialiser-0. You can already choose if you want exceptions or not, if you want RTTI or not, if you want floating-point math to be optimised as if you're using real numbers (which can lead to subtle numeric instability) - or if you want the compiler to emit exactly what you've written, and so on and so forth.
Adding more safety options which we can turn on for our code would help us write safer code. We can measure the impact of initialise-with-0 for our case and decide whether to use it or not.