The following program compiles cleanly under Microsoft Visual Studio 2005 Version 8.0, with the /W4 option:
int main(void) { int a = 14; int b = sizeof( a++ ); printf("a, b = %d, %d.\n", a, b); /* prints a, b = 14, 4. */ return 0; }
The indicated expression will be discarded; consequently, any side effects in that expression will not be executed.
In the example, the variable a will still have a value 14 after b has
been initialized.Whether or not a size expression is evaluated when it is part of the operand of a
sizeof operator and changing the value of the size expression would not affect the
result of the operator (6.7.5.2).