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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

The State of C (1988)

21 点作者 StephenFalken超过 10 年前

4 条评论

kazinator超过 10 年前
&gt; <i>To complete the list of things that C might provide but doesn&#x27;t: It has no storage management, like Pascal&#x27;s new function</i><p>Pascal is essentially just the abandoned prototype for more grown-up designs like Modula-2.<p>The Modula-2 language an allocation mechanism more similar to malloc and free. And, actually, early versions of that were broken: there was a way to ask how much memory remains before trying the memory allocation request, with no way to know whether it succeeded.<p>Guess what? This was fixed in the ISO standard.<p>See here, the ISO function reference on modula2.org:<p><a href="http://modula2.org/reference/isomodules/isomodule.php?file=STORAGE.DEF" rel="nofollow">http:&#x2F;&#x2F;modula2.org&#x2F;reference&#x2F;isomodules&#x2F;isomodule.php?file=S...</a><p><pre><code> PROCEDURE ALLOCATE (VAR addr: SYSTEM.ADDRESS; amount: CARDINAL); (* Allocates storage for a variable of size amount and assigns the address of this variable to addr. If there is insufficient unallocated storage to do this, the value NIL is assigned to addr. *) </code></pre> So ISO Modula 2 has an allocator that pretty much exactly like malloc and free. (It&#x27;s worse: DEALLOCATE needs to know the size!)<p>If Pascal&#x27;s way was better, it would have survived into Modula-2.<p>Also, Modula-2 has I&#x2F;O functions that you try first, and then check the result. Streams are called &quot;channels&quot;:<p><pre><code> PROCEDURE ReadRestLine (cid: IOChan.ChanId; VAR s: ARRAY OF CHAR); (* Removes any remaining characters from the input stream cid before the next line mark, copying to s as many as can be accommodated as a string value. The read result is set to the value allRight, outOfRange, endOfLine, or endOfInput. *) </code></pre> More like C, again. None of this business of knowing whether we are at end-of-file or end-of-line without trying any input.
Maken超过 10 年前
&gt; C also provides a goto statement, but it&#x27;s infrequently used.<p>Whoever wrote this was a bit naïve.
评论 #8403148 未加载
AdmiralAsshat超过 10 年前
<i>&gt; C is a general-purpose programming language that was originally designed and implemented around 1972 by Dennis Rithie at Bell Labs. Its early growth was closely associated ith the Unix system where it was developed, since both the tern and most of the programs that run on it are written in C.</i><p>Three typos in the first two sentences. Was this transcribed? I&#x27;m a little suspicious now of the attributed authorship, since I somehow doubt that Dennis Ritchie would misspell his own name.<p>EDIT: There&#x27;s this snippet as well at the end: &gt; <i>In the meantime, C wears well as your experience with it grows. With 15 years of C experience, we still feel that way.</i><p>So I&#x27;d put it the article&#x27;s original publication date sometime between 1988 and 1990?
expr-超过 10 年前
I doubt very much that the bulk of the text was written in (or near) 2005. Thus it tells very little of the state of C in 2005, but might otherwise prove to be mildly interesting read on the 80s.
评论 #8402878 未加载
评论 #8402837 未加载