best/worst code youve seen?

Pages: 123
Indeed it's not perfect, indeed it could be better
So what's wrong with a little critique?

we all know you hate C++ senselessly, as most of us hate Java senselessly
Can you define "we"? Do you have some kind of mind-reading ability or what?

leave your C++ senselessness for your Java forarms
I would personally feel better if you left your whining for yourself.

So why do you keep bringing up Java?
LB did that first.
On topic: I vote for the code J4ke posted. It's just pure awesomeness.
The ol' switch-on-boolean...
1
2
3
4
5
6
7
8
9
10
11
    bool isFoo;
    //...
    switch(isFoo)
    {
    case true:
        //if...
    case false:
        //else...
    default:
        debug_assert("Shouldn't happen!"); // ya think!?
    }
I saw it in code that had been through review, which I guess is an abbreviation for rubber-stamping.
Actually, I've seen the boolean switch as well. At one time, this would cause an optimization that would turn it into a jump table internally. I don't recall if this was an actual speedup but that was the intention I believe.
Last edited on
Speaking of booleans, today's talk of the net was this boolean condition from gcc: https://github.com/mirrors/gcc/blob/7057506456ba18f080679b2fe55ec56ee90fd81c/gcc/reload.c#L1056-L1110
closed account (10X9216C)
Can you define "we"? Do you have some kind of mind-reading ability or what?

Damn straight. There is more to mind-reading life than this single thread boy.
myesolar wrote:
we all know you hate C++ senselessly, as most of us hate Java senselessly

"we"? As in the voices in your head? You have got to learn to speak for yourself and not others because I don't hate any language. Every language has pros and cons, but nothing to hate them for.
I hate C# because programs written in C# seam to take forever to start up and it drives me absolutely insane. A few times I accidentally opened a file in visual studio 2014; wanted to throw my computer out of the window; ctl-alt-del ...
*shrugs* It must just be that I love languages and love to learn them. I've dabbled with A LOT of languages and can't say I've ever found anything that made me hate them.
BHX: brainfuck++
What is to hate about BF or the BF++ extension. I find it absolutely fascinating. I even found ArnoldC fascinating, I may not consider them practical, but still fascinating.
Have you had a look at befunge? That's a really interesting esoteric language.
No, I'll have to look into befunge though. I find them all interesting, but don't use all of them.
is befunge the one that took a beam search written in lisp to generate hello world? anyways, when you use brainfuck++ its almost useful that you can actually use it for a real major project, but it ends up nope
1
2
3
4
5
#include <stdlib.h>

void main() {
    system("echo \"hello world\"");
}
cheraphy: is that the best code youve seen or the worst?
Which do you think? :P
best?
Yep!

sarcasm
Lets see, void main and system? Shortest example of what never to do for printing output to terminal.
Pages: 123