Compiler Warnings Practices
Discussions center on the importance of enabling all compiler warnings (e.g., -Wall, -Wextra, -Weverything), treating them as errors with -Werror, and best practices for handling them in C/C++ codebases to prevent bugs.
Activity Over Time
Top Contributors
Keywords
Sample Comments
The compiler can issue warnings for this.This os why in C it is a good practice to enable all compiler warnings and to have the compiler treat warnings as errors.
How about "taking heed of compiler warnings" as suggested by Linus? it's niether expensive nor mentally taxing
I'll have to check when I get home, but I'm fairly certain you're purposefully suppressing the compilers warnings here. That's not a good way to make your argument about the compiler not being able to warn you about problems.
It shouldn't be too hard for compilers to warn about this, I think.
I don't feel it's so bad. You have a a specific flag to tell the compiler to show warnings if you have any.
Nice. These sorts of warnings are why it's worth investing the extra effort to enable -Werror in your codebase if you can.
"Treat warnings as errors" is a standard best practice.
Treat warnings as errors is terrible practice.
Yes! Was going to suggest much the same: crank up the warnings and treat them as errors!
In which case a warning would also do the trick, unless the compiler produces so many warnings that people stop caring.