5 ms·
> "-Winit-self" actually disables the common "var x = x" idiom which is used to silence "uninitialized variable" warnings. so now we have a flag that disables
by pilif 13y ago
> "-Winit-self" actually disables the common "var x = x" idiom which is used to silence "uninitialized variable" warnings.
so now we have a flag that disables a hack in code that is used to disable a warning caused by another flag. This is about as ridiculous to my (untrained in C) mind as it is to have -Wall not in-fact turn on all warnings.
- tenfingers 13y agoThe number of warnings that GCC can generate can cover some very speculative grounds, which are sometimes legitimate code. In fact many C idioms that were considered commonplace are now "warnings" because of the subtle semantics. Take assignment/evaluation in a condition: if(a = [expr]) was not so frowned upon before, because it was sort of implicit that "a" was also needed in the nested block that followed. Now it's a warning without a double parenthesis, because it's also common the typo of using = instead of ==. The list goes on and on. In fact, the level of diagnostics that you get in C is pretty bit, and probably one of the best in class compared to any other language thanks to the maturity of the toolchain.