G
Guest
Consider the following small program
#include <stdio.h
#define printvars printf("a = %d, b = %d, c = %d\n", a, b, c)
int main(
int a = 1, b = 2, c = 3
printvar
int x = a + (b += 3)
printf("x = %d\n", x)
printvar
return 0
on line 3, I'm saying I want the variable b to be incremented by 3, and then the result added to a and the result of that stored in x
But is it according to the C++ standard that the expression '(b += 3)' should actually RETURN 'b+3' aswell as just doing the action of incrementing 'b' by 3? Or does it just happen to on MSVC
Thanks
#include <stdio.h
#define printvars printf("a = %d, b = %d, c = %d\n", a, b, c)
int main(
int a = 1, b = 2, c = 3
printvar
int x = a + (b += 3)
printf("x = %d\n", x)
printvar
return 0
on line 3, I'm saying I want the variable b to be incremented by 3, and then the result added to a and the result of that stored in x
But is it according to the C++ standard that the expression '(b += 3)' should actually RETURN 'b+3' aswell as just doing the action of incrementing 'b' by 3? Or does it just happen to on MSVC
Thanks