75 comments

[ 2.9 ms ] story [ 153 ms ] thread
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.
This task was a staple of early years of the IOCCC:

https://www.ioccc.org/1992/lush.c

https://www.ioccc.org/1989/jar.1.c (cf. https://www.ioccc.org/1989/jar.1.hint)

https://www.ioccc.org/1986/applin/applin.c

https://www.ioccc.org/1986/holloway/holloway.c

https://www.ioccc.org/1985/applin/applin.c

https://www.ioccc.org/1984/anonymous/anonymous.c

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: https://ideology.com.au/polyglot/

You may not like it, but...

P.S. if you liked this comment, you'll love https://news.ycombinator.com/item?id=23183383!

> 4. Keep the blank lines at the start of the program. They are important.

lol

I lol’ed with

> This program is (supposedly) the smallest C program able to print "Hello world.". The compilation itself produces the desired printout and the program need not be actually run.

I believe peak Hello World is actually written in Chicken [0].

> 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 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 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

> 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 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 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 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 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 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

> 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 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

> 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 chic...

This is the most chicken shit code I've ever seen - and I used to make a living doing VB6+COM
chicken chicken Buffalo buffalo buffalo buffalo chicken chicken
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.

DAAAAAAAAAAhhhhhh ?

Rooooaaahahhahah!!

GAAAAAAAGAAAAAAAAAAGAAAGAWWWWOM!

GAAH!! GAH AAAAAAAH!

Haaaaaooa

BrrooaAAAH GAAH

WWAAAAAAAAAAAAAAAH!!!!!!!

GeeaaahH! AAAH

OOOOOOH

BlOOOOOOOOpppH

GAH! GobidoaaahH !

Sounds like Lady Gaga song
It's supposed to sound like raving rabbids.
Caps lock is uncouth here in hackernews, please tone it down to lowercase.
It's a yelling programming language. Lowercase characters are ignored.
Put it in a code block then.
Can’t tell if this is a joke or you failed to read the comment you replied to.
I don't think any of these are particularly convoluted; they'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.

What I'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 "Hello World". (I've no idea how to do this.)

[1] https://en.wikipedia.org/wiki/Goodstein%27s_theorem

Just my opinion but seeing how compiler behaves with each of them would have been much more interesting, for now it's just a hacky-ish way of getting the ascii codes.
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.
Oops, thanks for pointing it out! I've fixed it now.
Oh god, the convolution to recursive main switch? I am full of awe, it is so awful.
This is hilarious and I see how it could be used in a malicious context.
Is there a reverse of code golf? Code basketball?

Maybe that's just junior development.

“Code Survivor”.. Outwit, outlast, outplay. ;)
I like how there is the comment "you can't forget \0" for r[12] in the first example... but he forget it in the second haha. You should use calloc in that case !
Mention of HelloWorldFactoryFactoryFactorySingleton gives me panic attack flashbacks to the nineties
Why is he using buffered IO? and why use malloc? why not use write() and sbrk() like a real man?
We need to go deeper. This needs to be a kernel module that draws these pixels directly to the display buffer.
If you are in text-mode it's very easy to display text https://wiki.osdev.org/Printing_To_Screen
We're not trying to make this easy :) We need some computer vision code to search the display buffer itself to find out where the terminal is and figuring out where to draw the pixels!
https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris...

FizzBuzz Enterprise Edition is a no-nonsense implementation of FizzBuzz made by serious businessmen for serious business purposes.

This is hilarious and eerily real world like.
Be sure to check out the issues, too :)
Enterprize FizzBuzz has been one of my favourite things for a while. It perfectly captures the attitude where I used to work, where people felt that by adding later upon layer of obfuscation they were doing engineering.
This was a lot more fun before Github started collapsing directories of one item!
That makes it more fun because you never know when the rabbit hole will end.
Cutesy reminder that regular fizzbuzz still filters out almost half of the candidates I receive for junior dev positions.

Some because they don't understand the requirements, some because they don't know how to use loops, some people they don't know how to use conditions, and yes some because they make overly complicated mess for no reason, or to try to be "super smart".

>because they make overly complicated mess

https://thedailywtf.com/articles/The-Fizz-Buzz-from-Outer-Sp...

Hah, I remember having no clue what was going on the first time I read that, but it clicked just now. The fizzbuzz problem as described in that paragraph could almost be interpreted as 3 equations. The math was for something along the lines of this problem:

  x = fizz / 3
  x = buzz / 5
  x = (fizz * buzz) / 15
In this system of 3 equations, what is "x"?

Not sure what's going on with the 1-100 though.

I have this: https://github.com/LanceH/fizzbuzz in my back pocket just in case it is asked in an interview. I have the seed memorized to put in last while they're wondering what in hell I'm doing.

If the interviewer can't handle my sense of humor, then I'm not working there.

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.
This is one should be used in place of the traditional printf for beginners as a way to learn C in one single shot.
I was expecting k8s and terraform in there...
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'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'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.
I discovered a bug: the second example forgot the NUL byte.
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:

  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(''.join(chr(int(c.dot(np.array([bb(xx) for bb in b]))*251.+.1)) for xx in x))
It needs a dataframe to qualify as DS...
Well, it fits a curve to some data, so I think it just counts.
But this could be just regular science. To be sure we need a dataframe...
Upgrade this from a linear system solve to a (perhaps Mixed Integer) Linear Program solution and then we're talking!
There's no limit to how many arrays you can xor together to get "Hello, World!". They'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.