Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Not an issue if you make use of the tools available:

https://godbolt.org/z/xW14hGeoj



It looks like (a) this is a warning, not an error (why? the code is always wrong) and (b) the warning was added in clang 21 which came out this year. I also suspect that it wouldn't be able to detect complex cases that require interprocedural analysis.

The bug I saw happened a few years ago, and convinced me to switch to Rust where it simply cannot happen.


A warning in C, C++ is the compiler saying "this is terribly broken, won't do what you want and I will exploit this". As opposed to an error, which means "I don't even know what you mean". Taking warnings lightly isn't the way to go in C or C++.



Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: