Re: [GD-General] The joy of type aliasing and C
Brought to you by:
vexxed72
From: Brian H. <ho...@py...> - 2003-12-26 21:01:20
|
> The only snafu is Appendix C's list of sequence points, where it > says that a "full" expression is a sequence point, but I'm not > quite sure if an assignment is considered a full expression (known > full expressions are expressions used in a return; selection > statement; function calls; and "the expression statement in an > expression"). Turns out it is. An assignment expression or function call is treated as a "void expression" which is evaluated specifically for its side effects and thus should count as a full expression and, by extension, as a sequence point. So if this chokes an optimizer: x =3D * ( int * ) &f; Due to an assignment that occurs on 'f' earlier not being done until after the assignment to 'x', then it is the optimizer's fault, and not the programmers. Not to say that a programmer shouldn't be aware of this stuff and deal with it properly, of course =3D) Brian |