What is the most beautiful code you have ever seen? Pls give links to the repos or screenshots.
"beautiful" in your opinion and by your definition of "beauty", of course
>>54838600
An interrupt handler in an OS I made for fun
I cba to give links because I'm on my phone and it's easily searchable and I hate you all, but there really is some gorgeous code in quake (qw/2/3). Spent hours browsing and learning how they all fit together over the years.
This is pure beauty in my eyes.
github.com/mame/quine-relay
not sure if that counts
>>54838684
what is that what the fuck line?
>>54839117
Literally Google it you nigger
>>54838684
did he say where he derived his magic number, or did he just pull it out of his ass? I heard the theoretical best number isn't as good.
>>54840248
he found it somewhere. he didn't come up with it himself.
>>54838684
It's a cool idea really, and I like the formatting style, but honestly it's not exactly what I would call beautiful. Much of it is unnecessary, you could just as well write the function shorter, like:float Q_rsqrt ( float number )
{
long i;
float y;
y = number;
i = * ( long * ) &y;
i = 0x5f3759df - ( i >> 1 );
y = * ( float * ) &i;
y = y * ( 1.5F - ( 0.5F * number * y * y ) );
return y;
}
and get the same result. Then again, maybe they had some ancient compiler with shitty optimization that they were trying to exploit with that weird code.
Also, the recasting with * ( type * ) & is kind of hacky and should be avoided if possible. Better would befloat Q_rsqrt ( float number )
{
union {
float y;
long i;
} z;
z.y = number;
z.i = 0x5f3759df - ( z.i >> 1 );
z.y = z.y * ( 1.5F - ( 0.5F * number * z.y * z.y ) );
return z.y;
}
>>54840310
>sokeks
>captcha: 420
yolo
>>54840636
>I'm a faggot here's me coding like a faggot
Okies petal
>>54838600
http://dafoster.net/articles/2013/04/07/beautiful-code-sqlite/
>>54840636
Just so you know: that trick is obsolete. Directly using SSE's rsqrtss is much faster.
>>54840935
Yupp, I know. On my machine at least just using 1.0 / sqrt is about three times faster. But the last code I posted with the union instead the cast is actually twice as fast as the original code on my machine.
>>54840310
absolutely disgusting
also
>that font
kys
>>54840310
YOU NEED TO STOP THIS RIGHT NOW
DOOM is the most beautiful source code i've ever read.
Does this count?
https://www.youtube.com/watch?v=0m6hoOelZH8
https://www.youtube.com/watch?v=t5EI5fXX8K0
This should be required viewing.
>>54838600
> beautiful code
Only SJW fucktards see code as "beautiful"
>>54840310
>Pajeet-tier font
>>54842082
All code is beautiful, unless you're a problematic shitlord.
Don't you even dare call code "sexy" either.
>>54838600
You guys are all code gay :^)
>>54842060
Shit nigga, I'm away from home during the summer with minimal internet access and these lectures are going to be part of my technological feed now. Thanks.
>>54840310
I had an epileptic seizure looking at this and I don't even have epilepsy.
>>54842344
It's intro level CS but they go very in depth on what they get into. Very entertaining lectures even if you already know the concepts
Anyone who:
1. calls code "beautiful" (not optimal, readable, maintanable, clever etc., but "beautiful"),
2. claims "programming is an art",
3. calls himself or someone else a code artisan/ninja/maverick/maven
is a pretentious fucking douchebag.
>>54842588
>pythonista
>>54842588
Programming is an art.
static int IsNegative(float arg)
{
char*p = (char*) malloc(20);
sprintf(p, "%f", arg);
return p[0]=='-';
}
The more you look at it, the beautifuler it gets.
>>54842660
>pythoneer
>>54842938
Truly terrifying
>>54842938
>not including space anywhere between variable declaration and name
>allocating extra memory for something that could be done just as easily with a comparison operator
disgusting
>>54843503
>>54843513
>I cannot appreciate art when I see it.
This piece of code is at the frontier of software development.
>>54840248
https://en.wikipedia.org/wiki/Fast_inverse_square_root
https://github.com/id-Software/DOOM-3/blob/master/neo/game/Game_local.h#ifdef ID_DEBUG_UNINITIALIZED_MEMORY
// This is real evil but allows the code to inspect arbitrary class variables.
#define private public
#define protected public
#endif
>>54843687
wew