3 ms·
Infinite loops are UB in C++
- deleted 3y ago[deleted]
- cwstarblazer 3y agoYet more proof, if any was needed, that C++ is a lost cause and never should've existed. Undefined behavior in C is bad enough, but apparently the C++ people decided to take it to the next level. In the old days, C(++) had a pretty clean correspondence to assembly, and you could picture the generated assembly in your head as you went, while(1); would map pretty easily to loop: jmp loop
- floxy 3y agoWhat is the genesis of this? Did someone discover this using a fuzzer? Or is this a minimal test case of a real-world program that someone was pulling their hair out over for a while.
- stefanos82 3y agoIf you grep the entire c++ draft from https://eel.is/c++draft/ https://eel.is/c++draft/ with the word 'undefined', it will return '1087', as it was generated on 2024-02-28 from the LaTeX sources...not 1 or 2, but 1087 freaking times!!! I used to be obsessed with C++, started back in 2002, but after many attempts to learn it, let alone to master it, I have decided to direct my attention elsewhere as it's not worth it anymore :( When they fix it and trim it down to a slimmer version, they can let me know.
- tyfighter 3y agoThis just in - cherry-picked shitty C++ code behaves shittly. Who cares?
- spc476 3y agoSomeone compiling C code (where this is defined and NOT UB) with a C++ compiler (where is IS UB). I think using a C++ compiler on C code is a mistake, but not everyone shares my opinion.