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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

C is not Turing-complete

2 点作者 EvgeniyZh7 个月前

4 条评论

DemocracyFTW27 个月前
I beg to differ:<p><i>The C standard bakes in enough details about pointers such that the amount of memory a C program can access (even on a hypothetical infinite-memory machine) is bounded and statically known. Access to an unbounded amount of memory is necessary (but not sufficient) for Turing completeness. Therefore C is not Turing complete.</i><p>The argument is—insofar factually true about C which I cannot judge—sound, and I agree that C is <i>according to this view</i> not without bounds, hence not Turing-complete.<p>But is that viewpoint acceptable in light of what people commonly think of when discussing Turing-completeness? I think it hardly is. Because if it were, then no actually existing software would have ever passed the test for the simple reason that in the physical world unbounded memory can only exist as an approximation, not as an actuality.<p>But I contend that programs, like computers, can only exist in the physical world. The author seems to conceptualize only computing hardware to be tied to the physical world whereas computing software exists in a Platonic ethereal world of imagination, and therefore, it is enough to hand-wave the inherent limitations of the <i>hardware</i> away with a &#x27;let&#x27;s imagine&#x27;. However, real software is as physical as hardware. Therefore, if we grant the hardware the privilege of not having to be <i>actually</i> infinite to satisfy Turing, we&#x27;re bound to grant the same to software—in other words, once you can show that in principle, you can always upfront somehow ensure you don&#x27;t &#x27;run out of paper tape&#x27; (as one actually does in newspaper printing, where paper is &#x27;endless&#x27; in this sense) and you can likewise ensure, upfront, that your program will be given access to just enough memory, then that does not, in the common understanding, hamper Turing completeness.<p>Of course, should it turn out that there&#x27;s a principled reason why one C program cannot ever access more than—pulling out of thin air—23TB of memory, then that would be some sort of argument, even though in practice there&#x27;s a limit to when we think of memory as &#x27;limited&#x27; in a practical sense.<p>Coming to think of it, can&#x27;t one write a C program that, while in itself limited in terms of RAM addressability, can spawn copies of itself? When the processes maintain pointers between parent and child process, that should overcome any limitations on Turing-computability since then the tape &#x2F; RAM can be accessed across process boundaries.
评论 #41845762 未加载
thayne7 个月前
&gt; We have one more mechanism to store values: the return value of a function! Fortunately, the C spec doesn’t impose a maximum stack depth3, and so we can in principle implement a pushdown automata.<p>Am I misinterpreting this, or would this mean that the abstract machine <i>is</i> turing complete, if you had an unbounded stack?
snarbles7 个月前
Not my area of expertise, but if theoretical turing-completeness requires potentially infinite storage, doesn&#x27;t the possibility of file or network access neuter any argument that a finite address space renders C non-turing-complete?
kstenerud7 个月前
In other words: &quot;How many angels can dance on the head of a pin?&quot;<p>These kinds of pedantic arguments serve nothing but ego.
评论 #41845276 未加载