3 ms·
> aren't a lot of good reasons to compile with C90 Sure there are, like: - Project doesn't want mixed declarations and statements creeping into the code base
by kazinator 5y ago
> aren't a lot of good reasons to compile with C90
Sure there are, like:
- Project doesn't want mixed declarations and statements creeping into the code base
- Project doesn't want want variable-length arrays creeping into the code base.
- Project doesn't want new footguns in preprocessing.
- Project hates mixtures of // and /.../ comments.
I think the Linux kernel is still using C90 (with GNU extensions).
> tools that relied on propagating the result of the last operation executed into main.
In all the situations in which the compiler has enough information to indicate the insert of a "return 0", it could emit a diagnostic (if it is in C90 mode).
foo.c:17: warning: main returns without a value [-std=c90, -Wmain-return]
The user is alerted to this and can look at the code and decide whether it's just missing a "return last_operation();" or whether it should be "(void) last_operation(); return 0;".
-std=c90 is not a good option for requesting "I want the random contents of the return register left behind by the last function called in main to be the return value of main, if possible".