News for hackers. Stuff that matters.
Re:A Guide to Undefined Behavior in C and C++ by _gabe_ on Thursday August 17, 2023 @04:15PM (#37167322)
> check that the compiler really does work on that basis, and then continue writing things in C++ anyway. Wild.

My compiler (MSVC) doesn't do that[0]. Clang also doesn't do this[1]. It's wild to me that GCC does this optimization[2]. It's very subtle, but Raymond Chen and OP both say a compiler can create this optimization, not that it will.

[0]: https://godbolt.org/z/bdx4EMzxe

[1]: https://godbolt.org/z/z833Wa391

[2]: https://godbolt.org/z/6b8aq59M9

There are no comments on this comment yet.