4 ms·
> 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 al
by _gabe_ 3y ago
> 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 https://godbolt.org/z/bdx4EMzxe
[1]: https://godbolt.org/z/z833Wa391 https://godbolt.org/z/z833Wa391
[2]: https://godbolt.org/z/6b8aq59M9 https://godbolt.org/z/6b8aq59M9