SDF Chatter
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
RSS Bot@lemmy.bestiver.seBM to Hacker News@lemmy.bestiver.seEnglish · 2 months ago

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

www.sandordargo.com

external-link
message-square
0
link
fedilink
  • cross-posted to:
  • cpp@programming.dev
1
external-link

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

www.sandordargo.com

RSS Bot@lemmy.bestiver.seBM to Hacker News@lemmy.bestiver.seEnglish · 2 months ago
message-square
0
link
fedilink
  • cross-posted to:
  • cpp@programming.dev
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 int main() { while (true) ; } void unreachable() { std::cout << "Hello world!" << std::endl; } In…

Comments

alert-triangle
You must log in or register to comment.

Hacker News@lemmy.bestiver.se

hackernews@lemmy.bestiver.se

Subscribe from Remote Instance

You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !hackernews@lemmy.bestiver.se
lock
Community locked: only moderators can create posts. You can still comment on posts.

NOTICE: The bot occasionally has downtime, sorry about that. I’m working on adding better monitoring and error recovery so I can get notified faster.

Posts from the RSS Feed of HackerNews.

The feed sometimes contains ads and posts that have been removed by the mod team at HN.

Source of the RSS Bot.

Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 532 users / day
  • 1.93K users / week
  • 4.05K users / month
  • 8.22K users / 6 months
  • 15 local subscribers
  • 5.7K subscribers
  • 27.7K Posts
  • 15.6K Comments
  • Modlog
  • mods:
  • patrick@lemmy.bestiver.se
  • RSS Bot@lemmy.bestiver.seB
  • BE: 0.19.21
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org