GoThread
appearance log in
home all local communities
c/cpp@programming.dev

C++

log in to join
follow from another instance

Not on this instance? Enter your own instance's domain to go straight to following c/cpp@programming.dev there.

hashtags

#cpp
0
c/cpp@programming.dev · CodiUnicorn@programming.dev · 25 Sep 2026 14:19

C++26: Trivial infinite loops are no longer undefined behaviour

#cpp
Sandor Dargo’s Blog C++26: Trivial infinite loops are no longer undefined behaviour Let’s start with a question! Is this program well-defined? 1 2 3 4 int main() { while (true) ; } If you said yes, you’d be wrong — at least before C++26. A while (true); loop with no side effects used to be undefined behaviour. Compilers were free to assume it terminates, and some — Clang in particular — would optimize it away entirely, with spectacular consequences: 1 2 3 4 5 6 7 8 9 10 11 // https://godbolt.org/z/WYMxxeW1T #include <iostream> int main() { while (true) ; } void unreachable() { std::cout << "Hello world!" << std::endl; } In… www.sandordargo.com

check post at origin

0 comments

0 comments

log in to comment.

about

The center for all discussion and news regarding C++.

Rules

  • Respect instance rules.
  • Don’t be a jerk.
  • Please keep all posts related to C++.
members
2404
posts
50
created
13 Jun 2023
active / week
1
active / month
3

moderators

  • @lysdexic@programming.dev
  • @Nihili0@programming.dev

rss · modlog

GoThread · self-hosted threadiverse · instances · modlog · rss · appearance · AGPL-3.0