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.
Aurornis · · focus · HN ↗
saghm · · focus · HN ↗
mathisfun123 · · focus · HN ↗
it's actually probably the most common footgun you'll encounter in practice: non-void functions with no return statements just keep executing past their end. ask me how i know.
compile with -Wreturn-type if you want to avoid such things...
kouosi · · focus · HN ↗
Isn't -Wreturn-type enabled by default in both gcc and clang atleast for c++?
mathisfun123 · · focus · HN ↗
drdexebtjl · · focus · HN ↗
mpyne · · focus · HN ↗
mitxela · · focus · HN ↗
pjmlp · · focus · HN ↗
mitxela · · focus · HN ↗
mathisfun123 · · focus · HN ↗
mitxela · · focus · HN ↗