C++ assignment - stylish or performance?
- by joejax
Having been writing Java code for many years, I was amazed when I see this C++ statement:
int a,b;
int c = (a=1, b=a+2, b*3);
My question is: Is this a choice of coding style, or it has real benefit? (looking for a practicle use case)
I think the compiler will see it the same as following:
int a=1, b=a+2;
int c = b*3;
(What's the offical name for this? I assume it's a standard C/C++ syntax.)