TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

The value of undefined behavior

24 pointsby OberstKruegeralmost 7 years ago

1 comment

andreareinaalmost 7 years ago
The trouble is checking for undefined behavior (is adding these two ints going to result in overflow?) without triggering said undefined behavior. Ideally the checks would either be available as a function defined by the spec so that the compilers can do the right thing depending on the architecture. Failing that the compilers would have to pattern-match common idioms like they do for other situations like exchanging two variables, rotating shifts, etc.