C++26: Trivial infinite loops are no longer undefined behaviour
Thread
Unofficial Hacker News client; not affiliated with Y Combinator.
C++26: Trivial infinite loops are no longer undefined behaviour
Unofficial Hacker News client; not affiliated with Y Combinator.
JoshTriplett · · focus · HN ↗
Insert screaming here.
An infinite loop, with no library calls whatsoever, gets a system call inserted. That's a horrible surprise waiting to happen.
The entire concept of the "forward progress guarantee" is broken. An infinite loop should compile to an infinite loop. Nothing more, nothing less.
ibobev · · focus · HN ↗
I think that a compiler option should control this. It can be a nice optimization, but the programmer should be able to opt out.
Xirdus · · focus · HN ↗
WalterBright · · focus · HN ↗
ibobev · · focus · HN ↗
WalterBright · · focus · HN ↗
It's not perfect, but the forest of such switches in C compilers motivated D to not have them.
cryptonector · · focus · HN ↗
WalterBright · · focus · HN ↗
nrr · · focus · HN ↗
Ada explicitly settled on `Character` being an enumeration type based on a specific character set encoding. When I learned Ada 95, the ARM specified the ISO 8859-1 character set for `Character`, likewise with `Wide_Character` and `Wide_Wide_Character` explicitly settling on 16- and 32-bit implementations of UCS. I wish more language specifications made decisions like this.
D following suit with tying its `char`, `wchar`, and `dchar` to UTF-8, UTF-16, and UTF-32 is commendable.