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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

“Hello, World” in zero lines of code

130 点作者 ashutoshgngwr超过 4 年前

15 条评论

veganjay超过 4 年前
The title of the stackexchange discussion is a little misleading. It really is: &#x27;&quot;Hello, World&quot; in what sloc thinks is zero lines of source code&#x27;<p>Most of the top solutions seem to take advantage of bugs in the way sloc tries to parse commented lines. e.g. many are:<p><pre><code> &#x2F;**&#x2F;&lt;do_something&gt;&#x2F;**&#x2F; </code></pre> And I&#x27;m surprised I don&#x27;t see a related bug issue in the git repo: <a href="https:&#x2F;&#x2F;github.com&#x2F;flosse&#x2F;sloc&#x2F;issues" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;flosse&#x2F;sloc&#x2F;issues</a><p>Still this is a fun read. I&#x27;m curious to see what other tricks are out there.
评论 #25632044 未加载
ibraheemdev超过 4 年前
&gt; 17 chars<p>&gt; &#x2F;&#x2F;^H^HHello, World!<p>&gt; After the forward-slashes for the comment, there are two backspace characters which erase them from the output.<p>Coolest solution in my opinion.
corytheboyd超过 4 年前
These threads are always such fun ways of seeing exotic features of stacks I don’t work with! Thanks for sharing I enjoyed it
ddevault超过 4 年前
Slightly more entertaining:<p><a href="http:&#x2F;&#x2F;www.ioccc.org&#x2F;1994&#x2F;smr.hint" rel="nofollow">http:&#x2F;&#x2F;www.ioccc.org&#x2F;1994&#x2F;smr.hint</a><p>This is an IOCCC entry for the world&#x27;s smallest quine, sizing up at 0 bytes of C. Some C compilers will compile an empty source file into a program which does nothing when executed, i.e. ouputs zero bytes, i.e. is a quine.
评论 #25635007 未加载
progre超过 4 年前
Oh I thought this was Jon Skeet&#x27;s &quot;hello world&quot; in 1 byte, written in his custom &quot;H&quot; language. Of course he could have done it in 0 bytes but that would just be silly.
评论 #25632055 未加载
评论 #25643191 未加载
m3kw9超过 4 年前
Mod the complier to compile files with no code or only comments to produce a hello world executable.
评论 #25635537 未加载
评论 #25635547 未加载
unnouinceput超过 4 年前
So, this is actually a bug in sloc, eh?<p>Quote: &quot;NPM&#x27;s sloc is a moderately popular tool for counting source lines of code in a file&quot;.<p>Never heard of it, personally I use LocMetrics. And it detects correctly that these are sources.
Bostonian超过 4 年前
In Fortran, Hello World is just<p><pre><code> print*,&quot;Hello, World&quot; end </code></pre> This is shorter than the way a Hello World program in Java, C, or C++ would be written.
xuhu超过 4 年前
Looks like a job for a fuzzer.
ganafagol超过 4 年前
How is the difference between some helper tool&#x27;s parser vs the corresponding copiler&#x27;s parser an interesting hackable enterprise?
评论 #25634728 未加载
评论 #25633320 未加载
dalu超过 4 年前
Such a clickbaiting title
评论 #25642797 未加载
rement超过 4 年前
Looks like sloc is about to get a ton of new test cases for their comment parsing system.
xwdv超过 4 年前
What is the biggest program that could be created this way with zero lines of code?
评论 #25631785 未加载
评论 #25632163 未加载
评论 #25631870 未加载
square_usual超过 4 年前
The current winner seems to be HTML at 23 bytes, though I would argue it doesn&#x27;t meet the requirements of the question, which call for a &quot;full program&quot;.
评论 #25631464 未加载
notinventedhear超过 4 年前
&gt; &#x27;&#x27;&#x27;&quot;&quot;&quot;&#x27;&#x27;&#x27;;print(&quot;Hello, World!&quot;);&quot;&quot;&quot;&#x27;&#x27;&#x27;&quot;&quot;&quot;<p>This is still one line of code.<p>It is a valid python program . This is because python will join strings that are adjacent strings (eg. &quot;foo &quot; &quot;bar&quot; is evaulated just like &quot;foo bar&quot;) and while multiline strings are commonly used as comments they are evaluated as a string-literal rather than a comment.
评论 #25633975 未加载