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.

Why do we need for an Undefined Behavior Annex to C++

67 pointsby luuabout 1 year ago

6 comments

wahernabout 1 year ago
Notably, the C standard <i>does</i> have an undefined behavior annex, Annex J.2, since C99. It&#x27;s not mentioned in the post, and this omission in tandem with repeated usage of &quot;C and C++&quot; at various points might suggest otherwise to some people.
评论 #39567402 未加载
j16sdizabout 1 year ago
&gt; We also will require future proposal authors to keep the annex updated if they add or remove undefined behavior. They are making undefined behavior an explicit topic to be discussed when reviewing a proposal.<p>This is great.
SunlitCatabout 1 year ago
I know, the goal is (in short) a listing of expected undefined behavior, which could improve security if developers follow along.<p>But isn&#x27;t putting undefined behavior into the standard an oxymoron, kinda?
评论 #39565646 未加载
评论 #39565312 未加载
评论 #39565150 未加载
评论 #39563812 未加载
planedeabout 1 year ago
Great stuff. It looks like a ton of upfront work, but will greatly improve the standard, and shouldn&#x27;t be too hard to maintain once it&#x27;s complete.
评论 #39563786 未加载
jurschreuderabout 1 year ago
I love how in C++ there seems to be this security issue, and now hundreds of people try to come up with different ways on how to tackle the problem.<p>Everybody wants to help and spend their free time on it.<p>You don&#x27;t see this in other languages so much. People just use those languages and &quot;they&quot; have to fix any flaws.<p>Also keep your bingo cards ready for people saying Rust does not have undefined behaviour.<p>I&#x27;m also not so sure Rust is even that safe. Yes it&#x27;s memory safe but the languages with the most vulnerabilities is not C++. It&#x27;s PHP, .NET, C, Java, JavaScript.<p>C++ is not an unsafe language. You can&#x27;t make a language safe by adding an &quot;unsafe&quot; keyword end expect everything outside it to be safe. Else .NET and Java would be lower on the list than C++ because they do have bounds checks and they don&#x27;t have raw pointers.<p>It&#x27;s a bit of a false sense of security and a play of words this &quot;unsafe&quot; keyword in Rust.
评论 #39568909 未加载
评论 #39568224 未加载
评论 #39569252 未加载
urbandw311erabout 1 year ago
Can we fix the post title? We don’t “need for” things, we “need” things.