Re: The joy of type aliasing and C

Brian Hook <[email protected]>
Newsgroups gmane.games.devel.general
Message-ID <2003122616117.986554@GATEWAY>
> 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 = * ( 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 =)

Brian




-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click
_______________________________________________
Gamedevlists-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gamedevlists-general
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_idU7
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.