Path: utzoo!attcan!uunet!mcsun!ukc!warwick!cudcv From: cudcv@warwick.ac.uk (Rob McMahon) Newsgroups: comp.lang.c Subject: Re: Order of evalution of expressions. Message-ID: <1990Sep19.105934.4218@warwick.ac.uk> Date: 19 Sep 90 10:59:34 GMT References: <6398@castle.ed.ac.uk> Sender: news@warwick.ac.uk (Network news) Organization: Computing Services, Warwick University, UK Lines: 28 In article <6398@castle.ed.ac.uk> elee24@castle.ed.ac.uk (H Bruce) writes: >Is the line > >value = *ptr - *ptr++; > >sensible C ? >In other words is there a specified order of evaluation of expressions ? Absolutely not, no. >Would the following lines be optimized by a compiler (so that value is >not loaded twice) ? > >value = *ptr; >value -= *ptr++; Well, gcc optimizes this to ptr++; value = 0; I suspect your code may be wrong :-) Rob -- UUCP: ...!mcsun!ukc!warwick!cudcv PHONE: +44 203 523037 JANET: cudcv@uk.ac.warwick INET: cudcv@warwick.ac.uk Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England