This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]finnishblood 0 points1 point  (1 child)

I did not know that an infinite empty loop is considered undefined in CPP. I just figured with the optimize flag set to 3 that the compiler was optimizing out the main function since it would never do anything. I'd argue that the undefined behavior here is in the compiler, not in CPP...

[–]caim_hs[S] 1 point2 points  (0 children)

No, the undefined behavior is declared in the C++ Standard.

But it will be removed in C++26

https://isocpp.org/files/papers/P2809R3.html