The Most Beautiful Piece of Code That Prints 42
fluentcpp.com
fluentcpp.com
#include <stdio.h>
#define SIX 1+5
#define NINE 8+1
int main(void)
{
printf("%d * %d = %d\n", SIX, NINE, SIX * NINE);
return 0;
}
https://github.com/Keith-S-Thompson/42I love C but I will never understand why C has a naive macro system.
It is kind of infuriating that the preprocessor always feels simultaneously _too powerful_ and _not powerful enough_ for the jobs you want to get done. I find myself reaching for other tools (kaitai, m4 etc) a lot more these days to take the role.
[1] as used, for example, in Plan 9.
#define SIX 1+8
#define NINE 5+1 > perl6 -e 'say "Life, the Universe and Everything".WHY'
42 #include <iostream>
int main(void)
{
std::cout << (6 * '9') % ('h'*'2'-'g'*'2') << std::endl;
}http://shakespearelang.sourceforge.net/report/shakespeare/sh...
42
#include <stdio.h>
int main(void) { puts("42"); return 0; }
(Coz 42 is Gods phone #, duh...)
VROOMFONDEL: Or may not be
MAJIKTHISE: …or may not be… a god, if this machine comes along the next morning and gives you ‘is telephone number?