Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!psuvax1!hsdndev!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Assignment Ops and Side Effects Message-ID: <15777@smoke.brl.mil> Date: 10 Apr 91 04:24:25 GMT References: <18324@crdgw1.crd.ge.com> <15765@smoke.brl.mil> <18355@crdgw1.crd.ge.com> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 20 In article <18355@crdgw1.crd.ge.com> volpe@camelback.crd.ge.com (Christopher R Volpe) writes: >In article <15765@smoke.brl.mil>, gwyn@smoke.brl.mil (Doug Gwyn) writes: >|>In article <18324@crdgw1.crd.ge.com> volpe@camelback.crd.ge.com (Christopher R Volpe) writes: >|>>The result of "c=1" in an expression context should be promoted to int. >|>Not if it's the operand of sizeof; that would make sizeof rather useless. >I don't think it would be useless at all. I could still do sizeof(c) and >get the size of a char if I wanted. Can you point me to a reference to >the Standard from which one can deduce that a NON-lvalue expression >of type char should NOT be promoted to int when it is the operand of >sizeof? 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. I see no room for for thinking that any sort of conversion should be performed.