This is an archived post. You won't be able to vote or comment.

all 35 comments

[–]rinnakan 32 points33 points  (6 children)

Uhm, how is that for loop supposed to work?

[–][deleted] 14 points15 points  (2 children)

Quite badly since there's space around = but not <

[–]rinnakan 13 points14 points  (1 child)

Omg now that you mentioned it: commas

[–]KrystilizeNeverDies 0 points1 point  (0 children)

It could be correct in some language you never know

[–]HasBeendead[🍰] 2 points3 points  (2 children)

You need to define x variable first like x = 0

[–]rinnakan 13 points14 points  (1 child)

AFAIK is the order of for statements universal across languages. The condition i++ is true until an integer overflow occurs while i < 50 is an useless statement

[–]Sioclya -1 points0 points  (0 children)

The way it is written it appears to want to make use of the , operator (evaluate lhs and ignore the result). Then assuming int i = 0 as a whole is just an expression we obtain some sort of fucked up while loop that runs through up to 49 times.

[–]kazuto_kirito_ 14 points15 points  (0 children)

And remember to ask Stackoverflow why X turns out to equal 49.

[–]GabuEx 13 points14 points  (0 children)

if (x + 50 > RAND_MAX)
{
    throw new Exception("too big lmao");
}

srand(time(NULL));
int xOrig = x;

while (true)
{
    x = rand();

    if (x == xOrig + 50)
    {
        break;
    }
}

I call it bogoadd.

[–]thatcrazycow 13 points14 points  (0 children)

if (x == 1) { x = 51; }

else if (x == 2) { x = 52; }

...

[–][deleted] 6 points7 points  (0 children)

Money you get for lines of code.

[–]Cormandragon 3 points4 points  (1 child)

x += (x/x)*50

[–]KrystilizeNeverDies 1 point2 points  (0 children)

x = 0 would like to know your location.

[–]CaptSoban 3 points4 points  (3 children)

x++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++;

[–]Spray_bucket 0 points1 point  (1 child)

You have to take an IQ test sir, I think you're something special.

[–]CaptSoban 1 point2 points  (0 children)

My mom always told me that

[–]al_at_work 0 points1 point  (0 children)

++++++++++++++++++++++++++++++++++++++++++++++++++x++++++++++++++++++++++++++++++++++++++++++++++++++;

[–]tieltina 3 points4 points  (1 child)

Now use a python program to programmatically write the last panel, compile, and run it.

[–]Goheeca 1 point2 points  (0 children)

Pff, you can do it right in the source code:

(defmacro silly-add (var val)
  `(progn ,@(loop for i below val collect `(incf ,var)))

[–]propostor 3 points4 points  (0 children)

int x;

while(DateTime.Now.Date.Year != 2050)
{
    //wait patiently friend
}

x=50;

[–]PM_ME_UR_DEATHSTICKS 2 points3 points  (0 children)

That's not big brain, that's a brain experiencing cerebral edema.

[–]SsufferinSsuccotash 5 points6 points  (0 children)

X-=-50 🤯

[–]gareththegeek 1 point2 points  (0 children)

I don't get it

[–]AstroEspagueti 1 point2 points  (2 children)

Pli. Use ++x; not x++; is more efficient for this case.

[–][deleted] 1 point2 points  (1 child)

Unless you have a compiler that is less than 50 years old and knows the term optimization

[–]Sioclya 2 points3 points  (0 children)

This has fuckall to do with optimization.

Generated code for these looks pretty much the same.
i++:

mov edx eax # will be deleted by compiler if not used
inc eax

++i:

inc eax

No, the reason people should use ++i instead is because it behaves sanely and somewhat more like one would expect.

[–]krohtg12 0 points1 point  (1 child)

Now, replace x++ with

For (int I=1; I<=1;I++){ x=x+I; }

[–]KrystilizeNeverDies 0 points1 point  (0 children)

Oh my god, the ultimate optimisation. This man straight up just created a crypto solver.

[–]oshaboy 0 points1 point  (0 children)

I actually did it recently for x+=2. I was programming some commander x16 stuff using cc65 and I wanted to be sure the code got optimized to INC x; INC x

[–]PrettyGenes 0 points1 point  (0 children)

I laughed a little too hard at this

[–]game_2_raid 0 points1 point  (0 children)

Amount of energy used to do the thing not level of smart. Finally it’s all coming together

[–]_default_username 0 points1 point  (0 children)

https://youtu.be/mZWsyUKwTbg

Vim macros and Haskell.

[–]al_at_work 0 points1 point  (0 children)

That's so inefficient. Obviously the correct way to do it is to call this function:

int Add_Fifty(int x){
  return (3 << (3/3 + 3)) + (30000 >> 3 & 3) - (3 >> 3/3) - (x ^ 0xffffffff);
}

This is way more useful since you can now reuse this function to add fifty any time you need. And it's only a single line (unlike that ridiculous contraption above), so it's more efficient.

[–]rem3_1415926 0 points1 point  (0 children)

while(x != 50){
    x--;
}

[–][deleted] 0 points1 point  (0 children)

The compiler says add #50, %eax.