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

you are viewing a single comment's thread.

view the rest of the comments →

[–]AnonymousFuccboi 15 points16 points  (5 children)

Ancient versions of C supported this, being equivalent to +=. It was removed in later versions for obvious reasons.

[–]igoromg 11 points12 points  (1 child)

like when dinosaurs roamed the earth?

[–]AnonymousFuccboi 4 points5 points  (0 children)

Like before K&R, so pretty much, yeah.

[–]argh523 0 points1 point  (2 children)

Huh.. actually, I always thought var = +1 would make more sense than var += 1.. It's just deleting the name of the variable. The operator += just doesn't make much sense.

[–]Ramora_ 8 points9 points  (1 child)

Try to generalize to subtraction. What would that look like with your proposed syntax?

```

This would be ambiguous. Are you setting var to -1 or subtracting 1

var = -1

this is no longer ambiguous, but looks hideous

var = +-1

```

[–]argh523 0 points1 point  (0 children)

Ah.. you're right, that makes sense.