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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

What Peak Hello World Looks Like

169 点作者 wh313大约 5 年前

36 条评论

kragen大约 5 年前
This task was a staple of early years of the IOCCC:<p><a href="https:&#x2F;&#x2F;www.ioccc.org&#x2F;1992&#x2F;lush.c" rel="nofollow">https:&#x2F;&#x2F;www.ioccc.org&#x2F;1992&#x2F;lush.c</a><p><a href="https:&#x2F;&#x2F;www.ioccc.org&#x2F;1989&#x2F;jar.1.c" rel="nofollow">https:&#x2F;&#x2F;www.ioccc.org&#x2F;1989&#x2F;jar.1.c</a> (cf. <a href="https:&#x2F;&#x2F;www.ioccc.org&#x2F;1989&#x2F;jar.1.hint" rel="nofollow">https:&#x2F;&#x2F;www.ioccc.org&#x2F;1989&#x2F;jar.1.hint</a>)<p><a href="https:&#x2F;&#x2F;www.ioccc.org&#x2F;1986&#x2F;applin&#x2F;applin.c" rel="nofollow">https:&#x2F;&#x2F;www.ioccc.org&#x2F;1986&#x2F;applin&#x2F;applin.c</a><p><a href="https:&#x2F;&#x2F;www.ioccc.org&#x2F;1986&#x2F;holloway&#x2F;holloway.c" rel="nofollow">https:&#x2F;&#x2F;www.ioccc.org&#x2F;1986&#x2F;holloway&#x2F;holloway.c</a><p><a href="https:&#x2F;&#x2F;www.ioccc.org&#x2F;1985&#x2F;applin&#x2F;applin.c" rel="nofollow">https:&#x2F;&#x2F;www.ioccc.org&#x2F;1985&#x2F;applin&#x2F;applin.c</a><p><a href="https:&#x2F;&#x2F;www.ioccc.org&#x2F;1984&#x2F;anonymous&#x2F;anonymous.c" rel="nofollow">https:&#x2F;&#x2F;www.ioccc.org&#x2F;1984&#x2F;anonymous&#x2F;anonymous.c</a><p>And this version, though too large to enter into the IOCCC, is not only valid C, but is additionally valid as COBOL, Pascal, Fortran, PostScript, a shell script, an MS-DOS .COM file, and Perl 5: <a href="https:&#x2F;&#x2F;ideology.com.au&#x2F;polyglot&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ideology.com.au&#x2F;polyglot&#x2F;</a><p>You may not like it, but...<p>P.S. if you liked this comment, you&#x27;ll love <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=23183383" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=23183383</a>!
评论 #23215721 未加载
评论 #23212741 未加载
mkl大约 5 年前
Oh, I think we can do better. C and bitwise operations are so 1980! Modern Hello Worlds should use modern languages, functional programming, and data science! Like so:<p><pre><code> import numpy as np x = np.array([0.03908342, 0.95362155, 0.95450865, 0.22260951, 0.35975305, 0.22841515, 0.3964834, 0.01782918, 0.05798498, 0.62697582, 0.69175475, 0.343705]) y = np.array([0.28685259, 0.40239044, 0.43027888, 0.43027888, 0.44223108, 0.12749004, 0.47410359, 0.44223108, 0.45418327, 0.43027888, 0.39840637, 0.1314741]) b = [lambda x, x0=x0: np.sqrt(.1+(x-x0)**2) for x0 in x]+[lambda x: 1., lambda x: x] a = np.array([[bb(xx) for bb in b] for xx in x]+[[1.]*12+[0., 0.], list(x)+[0., 0.]]) c = np.linalg.solve(a, list(y)+[0., 0.]) print(&#x27;&#x27;.join(chr(int(c.dot(np.array([bb(xx) for bb in b]))*251.+.1)) for xx in x))</code></pre>
评论 #23213858 未加载
评论 #23212529 未加载
评论 #23213655 未加载
macando大约 5 年前
<a href="https:&#x2F;&#x2F;github.com&#x2F;EnterpriseQualityCoding&#x2F;FizzBuzzEnterpriseEdition" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;EnterpriseQualityCoding&#x2F;FizzBuzzEnterpris...</a><p>FizzBuzz Enterprise Edition is a no-nonsense implementation of FizzBuzz made by serious businessmen for serious business purposes.
评论 #23212497 未加载
评论 #23212260 未加载
评论 #23211699 未加载
评论 #23212148 未加载
评论 #23211423 未加载
评论 #23211690 未加载
speakeron大约 5 年前
I don&#x27;t think any of these are particularly convoluted; they&#x27;re in straightforward procedural code with a line for each letter. Most programmers could adapt the code to produce another string without too much effort.<p>What I&#x27;d consider convoluted is something like the Goodstein sequence[1] which would grow to monstrous proportions using far more memory than could be stored even if every particle in the universe represented one bit and far more time than beyond when the last black hole has evaporated, yet collapsed down (eventually) to &quot;Hello World&quot;. (I&#x27;ve no idea how to do this.)<p>[1] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Goodstein%27s_theorem" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Goodstein%27s_theorem</a>
评论 #23211136 未加载
rixrax大约 5 年前
It occurred to me that this is maybe just marginally more unreadable than a Hello world for Android or iOS or other desktops after all the boilerplate code and resources has been added. And it still is easier to compile.
speedgoose大约 5 年前
My attempt from many years ago in GWAAAAAAAH. A brainfuck like programming language, for crazy rabbits where most characters are ignored and only for style.<p>DAAAAAAAAAAhhhhhh ?<p>Rooooaaahahhahah!!<p>GAAAAAAAGAAAAAAAAAAGAAAGAWWWWOM!<p>GAAH!! GAH AAAAAAAH!<p>Haaaaaooa<p>BrrooaAAAH GAAH<p>WWAAAAAAAAAAAAAAAH!!!!!!!<p>GeeaaahH! AAAH<p>OOOOOOH<p>BlOOOOOOOOpppH<p>GAH! GobidoaaahH !
评论 #23213957 未加载
评论 #23210984 未加载
评论 #23212344 未加载
TheOtherHobbes大约 5 年前
This seems kind of lightweight. There should surely be a web implementation that uses Docker, k8s, React, Typescript, Node, MongoDB, AWS, and GitHub, and still only works correctly in a specific version of IE8.
评论 #23212944 未加载
megavolcano大约 5 年前
Reminds me of the Java version, Hello World Enterprise Edition<p><a href="https:&#x2F;&#x2F;gist.github.com&#x2F;lolzballs&#x2F;2152bc0f31ee0286b722" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;lolzballs&#x2F;2152bc0f31ee0286b722</a>
catblast大约 5 年前
Good for a beginner effort, but its not really all that convoluted or obfuscated. The problem is that 90% of the obfuscation is in the removal of whitespace. Pretty print the final thing, and it isn&#x27;t so bad (the 2nd to last listing is pretty easy to follow). Things like 0-1 or 13*1 + 3, etc add some noise but are not particularly hard to parse or understand, the ternary is ugly but it&#x27;s sequential so nothing up the sleeve there, the memcpy are just a noisy one character assignment. The author should review the IOCCC submissions posted earlier. Like holloway.c.
unnouinceput大约 5 年前
This could be &quot;improved&quot; to make it get a sound &quot;Hello World&quot; instead of a visual one. I mean it&#x27;s still &quot;Hello World&quot; and I feel sound gets too little credit versus graphics.
nkozyra大约 5 年前
Is there a reverse of code golf? Code basketball?<p>Maybe that&#x27;s just junior development.
评论 #23212342 未加载
yesenadam大约 5 年前
Should output &quot;hello, world!\n&quot; (Kernighan, <i>A Tutorial Introduction to the Language B</i>, 1972) or &quot;hello, world\n&quot; (Kernighan, <i>Programming in C: A Tutorial</i> 1974 and Kernighan&#x2F;Ritchie, <i>The C Programming Language</i> 1978).<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;%22Hello,_World!%22_program" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;%22Hello,_World!%22_program</a>
Izkata大约 5 年前
My personal favorite is Piet, where all programs are images: <a href="https:&#x2F;&#x2F;www.dangermouse.net&#x2F;esoteric&#x2F;piet&#x2F;samples.html" rel="nofollow">https:&#x2F;&#x2F;www.dangermouse.net&#x2F;esoteric&#x2F;piet&#x2F;samples.html</a>
nayuki大约 5 年前
&quot;The Evolution of a programmer&quot;: <a href="https:&#x2F;&#x2F;www.ariel.com.au&#x2F;jokes&#x2F;The_Evolution_of_a_Programmer.html" rel="nofollow">https:&#x2F;&#x2F;www.ariel.com.au&#x2F;jokes&#x2F;The_Evolution_of_a_Programmer...</a>
lern_too_spel大约 5 年前
GNU Hello 2.10: <a href="http:&#x2F;&#x2F;git.savannah.gnu.org&#x2F;cgit&#x2F;hello.git&#x2F;tree&#x2F;" rel="nofollow">http:&#x2F;&#x2F;git.savannah.gnu.org&#x2F;cgit&#x2F;hello.git&#x2F;tree&#x2F;</a>
mkchoi212大约 5 年前
My eye balls hurt after looking at the final version of hell world. But a job very well done I must say. Could go even more insane with inline assembly but I’ll wait for part two for that :)
larsrc大约 5 年前
GNU Hello World is 700k as a .tar.gz: <a href="https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;hello&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;hello&#x2F;</a>
nicetryguy大约 5 年前
Ben Eater - “Hello, world” from scratch on a 6502 — Part 1<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=LnzuMJLZRdU" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=LnzuMJLZRdU</a>
G4E大约 5 年前
I like how there is the comment &quot;you can&#x27;t forget \0&quot; for r[12] in the first example... but he forget it in the second haha. You should use calloc in that case !
nurettin大约 5 年前
A simple standard C++ hello world introduces: functions, ctors, dtors, headers, header guards (you are including headers right away), namespaces (std, anonymous), operator overloading (&lt;&lt;), function overloading, pointer to function (endl), templates, traits, locales, streams (basic_ostream), lifetimes (cout), move operations, inheritance, static initialization (in locales) and a bunch of other things I surely missed.
recursive大约 5 年前
There&#x27;s no limit to how many arrays you can xor together to get &quot;Hello, World!&quot;. They&#x27;re all essential in the sense that removing any of them causes the result to fail. I am interested in awkward and arbitrary code optimization problems like code golf. But you can just take this one to infinity in a number of different ways.
helsinkiandrew大约 5 年前
Mention of HelloWorldFactoryFactoryFactorySingleton gives me panic attack flashbacks to the nineties
RangerScience大约 5 年前
Oh god, the convolution to recursive main switch? I am full of awe, it is so awful.
random_visitor大约 5 年前
Just my opinion but seeing how compiler behaves with each of them would have been much more interesting, for now it&#x27;s just a hacky-ish way of getting the ascii codes.
7373737373大约 5 年前
Here&#x27;s mine: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=lsaFmx5l7Hk" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=lsaFmx5l7Hk</a>
MayeulC大约 5 年前
The third code block has two `main` functions. This confused me a bit, but the first one is likely a mistaken copy-paste from the final version.
评论 #23212337 未加载
kervantas大约 5 年前
It reminds me of JSFuck. <a href="http:&#x2F;&#x2F;www.jsfuck.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.jsfuck.com&#x2F;</a>
tankenmate大约 5 年前
Why is he using buffered IO? and why use malloc? why not use write() and sbrk() like a real man?
评论 #23211499 未加载
vaibhavthevedi大约 5 年前
My reaction to the code mentioned was similar to the favicon image :)
GEBBL大约 5 年前
This is hilarious and I see how it could be used in a malicious context.
_nalply大约 5 年前
I discovered a bug: the second example forgot the NUL byte.
QuarterDuplex大约 5 年前
I don&#x27;t see anything with rand&#x2F;srand
davedx大约 5 年前
I was expecting k8s and terraform in there...
kevin_thibedeau大约 5 年前
Nitpick but NUL is not the same as null.
keithwhor大约 5 年前
I believe peak Hello World is actually written in Chicken [0].<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken<p>&gt; chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken<p>&gt; chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken<p>&gt; chicken chicken chicken chicken chicken chicken<p>[0] <a href="https:&#x2F;&#x2F;esolangs.org&#x2F;wiki&#x2F;Hello_world_program_in_esoteric_languages#Chicken" rel="nofollow">https:&#x2F;&#x2F;esolangs.org&#x2F;wiki&#x2F;Hello_world_program_in_esoteric_la...</a>
评论 #23210688 未加载
评论 #23210758 未加载
评论 #23211593 未加载
评论 #23211488 未加载
评论 #23211183 未加载
lkuty大约 5 年前
This is one should be used in place of the traditional printf for beginners as a way to learn C in one single shot.