Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

=+ Operator

Name: Anonymous 2010-08-25 4:36

Fuck, I've just been searching for a bug in my program for about three quarters of an hour. It ended up just being a single character typo.

I had typed 'Length =+ 2' instead of 'Length += 2'. The thing I can't understand is why GCC allowed it (even with -Wall). I've Googled and it's not a legal operator.

What the hell is it doing?

Name: Anonymous 2010-08-25 4:39

Length = +2;

Name: Anonymous 2010-08-25 4:40

Really?  Put a space between the = and the + and see if the fog starts to clear...

Name: Anonymous 2010-08-25 4:42

[code]
#include <stdio.h>
#define HAX(ANUS) 0
int main(int argc, char *argv[]) {
    int i;
    for (i = 10; i --> 1; ) printf("%i\n", i);
    return HAX(ANUS);
}

Name: Anonymous 2010-08-25 4:50

PI=3,14159;

Name: Anonymous 2010-08-25 4:51

Hey thanks. I had thought that the compiler wouldn't allow something like that (or at least point it out), but looks like I'm wrong. Thanks Anons.

Name: Anonymous 2010-08-25 5:10

>>6
Anons
No ``Anons'' here, pal.

Name: Anonymous 2010-08-25 8:12

>>6
Yeah, unary + is allowed in C/C++ for symmetry with unary - (negation). That's why it compiles.

I've heard that in ancient, pre-standard C (early 1970s) the += and -= operators were actually written =+ and =- in some implementations, and there was no unary + or -. Thankfully they've changed that.

Name: Anonymous 2010-08-25 8:14

This reminds me of the "goes to" operator:

int x = 100;
while (x --> 0) {
  printf("%i bottles of beer on the wall\n", x);
}

Name: Anonymous 2010-08-25 9:36

God I hate C grammar.

Name: Anonymous 2010-08-25 10:21

>>10
God, I hate C, Grandma.

Name: Anonymous 2010-08-25 10:29

>>10
I hate you too.

fuckin' meemaw

Name: Anonymous 2010-08-25 11:44

meemaw

What?

Name: Anonymous 2010-08-25 11:49

>>11
Got I hate Seagram, ma

Name: Anonymous 2010-08-25 16:51

Oh look, it's this discussion again.

Name: Anonymous 2010-08-25 19:22

>>9
That's the first time I saw that, got a chuckle out of me.

Name: Anonymous 2011-04-05 1:07

testing
testing

Don't change these.
Name: Email:
Entire Thread Thread List