2
-1

[–] boredTech 2 points -1 points (+1|-2) ago 

Dumbest argument of all time. Both operations are in O(K) time. Who gives a fuck?

0
2

[–] theNakedNecromancer 0 points 2 points (+2|-0) ago 

As long as you're not screwing with the way C performs the action, I don't see why not. In other words: x++ and ++x are two completely different functions.

So, doing x *= ++i will perform:

x = x * (i + 1)

But, doing x *= i++ will act like:

x = (x * i) + 1

Beyond that, style is up to you. Most C-coders (and style guides) won't want whitespace around the variable, or between a variable and increment operator. But, if it's code just for you, who cares?

0
1

[–] J_Darnley 0 points 1 point (+1|-0) ago  (edited ago)

No it won't. The second is equivalent to:

x = x * i;
i = i + 1;

a++ is "read then increment" whereas ++a is "increment then read".

0
1

[–] TheBuddha 0 points 1 point (+1|-0) ago 

https://softwareengineering.stackexchange.com/questions/223313/style-guide-for-c

However, it's more important to be consistent. Whatever you go with, be consistent.

1
-1

[–] WhiteMakesRight 1 point -1 points (+0|-1) ago 

Consistency is irrelevant when you're talking about two different operators with different semantics though. Use the one you actually need.