Assignment Ops and Side Effects

Christopher R Volpe volpe at camelback.crd.ge.com
Wed Apr 10 23:23:36 AEST 1991


In article <15777 at smoke.brl.mil>, gwyn at smoke.brl.mil (Doug Gwyn) writes:
|>Yeah -- the whole damn standard.  It doesn't contain a specific
|>statement that says "Don't invent rules along the lines of Volpe";
|>instead it gives rules for properly determining what does happen:
|>3.3.16 Semantics:  The type of an assignment expression is the type of
|>the left operand...
|>3.3.3.4 Semantics:  The sizeof operator ... size is determined from
|>the type of the operand, which is not itself evaluated.
|>performed.
                    
3.2.1.1: A char ... may be used in an expression wherever an int or
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
unsigned int may be used. If an int can represent all values of the
original typ
^^^^^^^^^^^^^^^^^^^^^^^^^
e, the value is converted to an int.; otherwise, it is converted to an
unsigned int. These are called the integral promotions.

This appears to say that this conversion occurs in any expression
context, subject to explicit exceptions made elsewhere.

Footnote 27, which is not even technically part of the standard, clarifies
this by saying, in effect, that these promotions are done only where
explicitly indicated, not by default with possible exceptions. Obviously
someone thought that people might reach the same wrong conclusion as I
did, otherwise there would be no footnote. 

I didn't notice the footnote. Other people were able to point this 
out to me in a polite, civilized, non-hostile, and non-insulting manner.
With all due respect, perhaps you could learn to chill out a bit. Not all
of us were on the committee and not all of us have the whole document
memorized and not all of us are so perfect as to not be able to miss a
footnote. 

|>I see no room for for thinking that any sort of conversion should be
|>performed.

I think you mean, "I see no room for not having as thorough an 
understanding of the language as I have."

==================
Chris Volpe
G.E. Corporate R&D
volpecr at crd.ge.com



More information about the Comp.lang.c mailing list