S
Sergey
Hello!
Could anybody be kind enough to explain this concept?
Why C++ make two ops for prefix and postfix ++ operator?
As I guess, it is possible to implement both cases via sole
prefix increment operation. Correct me if I'm wrong,
Let's see trival example:
Complex a=3,b;
b=a++-2;
Compiler could rewrite this as:
b=a;
++a;
b-=2;
So. why make extraneous overhead with temporary var for postfix
increment and 2 distinct ops?
Thank you for patience, Sergey.
Could anybody be kind enough to explain this concept?
Why C++ make two ops for prefix and postfix ++ operator?
As I guess, it is possible to implement both cases via sole
prefix increment operation. Correct me if I'm wrong,
Let's see trival example:
Complex a=3,b;
b=a++-2;
Compiler could rewrite this as:
b=a;
++a;
b-=2;
So. why make extraneous overhead with temporary var for postfix
increment and 2 distinct ops?
Thank you for patience, Sergey.