best/worst code youve seen?

Pages: 123
Jul 2, 2014 at 4:48pm
Indeed it's not perfect, indeed it could be better
So what's wrong with a little critique?

we all know you hate Python 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 Python 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.
Jul 2, 2014 at 5:00pm
On topic: I vote for the code J4ke posted. It's just pure awesomeness.
Jul 2, 2014 at 8:29pm
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.
Jul 2, 2014 at 9:31pm
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 Jul 2, 2014 at 10:21pm
Jul 2, 2014 at 9:32pm
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
Jul 2, 2014 at 10:31pm
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.
Jul 2, 2014 at 11:57pm
myesolar wrote:
we all know you hate Python 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.
Jul 3, 2014 at 1:48am
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 ...
Jul 3, 2014 at 2:07am
*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.
Jul 3, 2014 at 2:32am
BHX: brainfuck++
Jul 3, 2014 at 2:53am
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.
Jul 3, 2014 at 2:55am
Have you had a look at befunge? That's a really interesting esoteric language.
Jul 3, 2014 at 3:20am
No, I'll have to look into befunge though. I find them all interesting, but don't use all of them.
Jul 3, 2014 at 4:06am
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
Jul 3, 2014 at 4:14am
1
2
3
4
5
#include <stdlib.h>

void main() {
    system("echo \"hello world\"");
}
Jul 3, 2014 at 4:23am
cheraphy: is that the best code youve seen or the worst?
Jul 3, 2014 at 4:26am
Which do you think? :P
Jul 3, 2014 at 4:31am
best?
Jul 3, 2014 at 4:33am
Yep!

sarcasm
Jul 3, 2014 at 5:06am
Lets see, void main and system? Shortest example of what never to do for printing output to terminal.
Pages: 123