4 ms·
> I know others who lost an entire day staring at it wondering what's wrong with it. I saw it on X recently as "99% of C programmers will not be able to find th
by moefh 2y ago
> I know others who lost an entire day staring at it wondering what's wrong with it. I saw it on X recently as "99% of C programmers will not be able to find the bug."
Both gcc and clang give a warning[1] for that code with just "-Wall", so I's hard to imagine it being a real problem these days.
[1] https://godbolt.org/z/vfPzhc596 https://godbolt.org/z/vfPzhc596
- WalterBright 2y agoI know modern compilers do it, too. But still the language needs to be fixed. The proof is C programmers still get victimized by this useless feature. Compiler warnings are a good source of material for things that need to be fixed in the language. Unfortunately, every compiler has their own set of warnings, and sometimes warnings from different compilers contradict each other. That encourages programmers to not use the warning feature. That's another reason why the language should be fixed.
- uecker 2y agoIn my experience the warnings work quite well for the programmers I know. Anyway, ranting on HackerNews does not get anything fixed: https://www.open-std.org/jtc1/sc22/wg14/www/contributing.html https://www.open-std.org/jtc1/sc22/wg14/www/contributing.htm...
- pjmlp 2y agoWorking in offshoring projects for the lowest bid changes one's point of view, regarding "programmers I know" approach.
- uecker 2y agoI work a lot with students who can not program well in C. I would say turning on -Wall is not a difficult problem for them. If it is, then using another programming language also does not help.
- pjmlp 2y agoThat is already progress, compared with the quality of delivery in many offshoring projects. It usually might go so bad, that after a couple of years, a new management ends up onshoring it all over again. You might turn -Wall, but then who fixes the warnings? And better be prepared to fight managament if warnings break the build, as it "slows down sprint velocity with useless coding efforts". Unless required by some kind of certification laws or quality assessement on project delivery.