News for hackers. Stuff that matters.
Re:Some mistakes Rust doesn't catch by nybble41 on Tuesday February 08, 2022 @06:40PM (#30266459)
Actually it's only undefined (per C99 anyway) if the return value is used:

> If the } that terminates a function is reached, and the value of the function call is used by the caller, the behavior is undefined.

So if the return value is never used then there is no undefined behavior and a standards-compliant compiler isn't allowed to optimize away the loop exit condition.

There are no comments on this comment yet.