Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!hellgate.utah.edu!dog.ee.lbl.gov!elf.ee.lbl.gov!torek From: torek@elf.ee.lbl.gov (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Assignment Ops and Side Effects Message-ID: <11805@dog.ee.lbl.gov> Date: 4 Apr 91 22:17:48 GMT References: <1991Apr3.173046.2367@mccc.edu> <1991Apr4.202314.961@csrd.uiuc.edu> Reply-To: torek@elf.ee.lbl.gov (Chris Torek) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 26 X-Local-Date: Thu, 4 Apr 91 14:17:48 PST In article <1991Apr4.202314.961@csrd.uiuc.edu> bliss@sp64.csrd.uiuc.edu (Brian Bliss) notes that on at least one system: > char ch; > sizeof (ch += 1) == 4 > sizeof (ch++) == 1 >apparrently operands of ++ and -- do not undergo integral promotion I am tempted to claim that this is a bug in the compiler in question, but without the standard in front of me (I am reading news during breakfast at home) I will go only as far as saying that, from a reasonably abstract point of view, ch++ and ch += 1 should have the same type. Gcc 1.39, for instance, makes them the same. I doubt that gcc violates the standard in this regard, so either it is undefined or implementation-defined as to exactly when promotion occurs in assignment expressions, or else the compiler that gave you that result is not conformant. -- In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427) Berkeley, CA Domain: torek@ee.lbl.gov