TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Dennis Ritchie on alias analysis in C (1988)

62 点作者 r4um大约 4 年前

5 条评论

CyberRabbi大约 4 年前
I had a hard time following Ritchie’s argument. I guess I’m missing a lot from the proposals he’s critiquing. One part stood out that was not clear:<p>&gt; memcpy(noalias void *s1, const noalias void *s2, size_t n);<p>&gt; what information can one glean from it? Some committee members apparently believe that it conveys either to the reader or to the compiler that the routine is safe, provided that the strings do not overlap. They are mistaken.<p>I don’t follow. It seems that noalias exactly means that the two arrays can never point to the same memory, thus they do not overlap. So why would it be wrong to assume that memcpy() with noalias arguments is safe if called with non-overlapping memory?<p>————<p>Separately I agree with him that “noalias” unlike “const” is not a property of the object being pointed to but rather a property of the access being done. It creates an inconsistency where “char * noalias” makes sense but “char noalias” doesn’t. Perhaps he would have supported a “noalias dereference” operator or compiler built-in instead.
评论 #26524883 未加载
评论 #26524709 未加载
dooglius大约 4 年前
blogspam for <a href="https:&#x2F;&#x2F;groups.google.com&#x2F;g&#x2F;comp.lang.c&#x2F;c&#x2F;K0Cz2s9il3E&#x2F;m&#x2F;YDyo_xaRG5kJ" rel="nofollow">https:&#x2F;&#x2F;groups.google.com&#x2F;g&#x2F;comp.lang.c&#x2F;c&#x2F;K0Cz2s9il3E&#x2F;m&#x2F;YDyo...</a>
评论 #26525385 未加载
评论 #26524486 未加载
pjmlp大约 4 年前
Then 10 years later <i>restrict</i> was born with many of the same caveats that Dennis Ritchie refers to <i>noalias</i>.<p>A good example of when language authors no longer control its direction, rather the standards body.
评论 #26525692 未加载
kps大约 4 年前
“a license for the compiler to undertake aggressive optimizations that are completely legal by the committee&#x27;s rules, but make hash of apparently safe programs”<p>That phrase, describing ‘noalias’, proves that nobody at the time realized or intended what “undefined behavior” would turn out to mean.
xiphias2大约 4 年前
I think Dennis would love what Rust provides, it took just 45 years to fix noalias with a new language.
评论 #26524901 未加载