Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83 v7 ucbtopaz-1.8; site ucbtopaz.CC.Berkeley.ARPA Path: utzoo!linus!philabs!cmcl2!seismo!harvard!talcott!panda!genrad!decvax!ucbvax!ucbtopaz!mwm From: mwm@ucbtopaz.CC.Berkeley.ARPA Newsgroups: net.lang.c Subject: Re: C question Message-ID: <885@ucbtopaz.CC.Berkeley.ARPA> Date: Tue, 9-Apr-85 16:43:41 EST Article-I.D.: ucbtopaz.885 Posted: Tue Apr 9 16:43:41 1985 Date-Received: Fri, 12-Apr-85 07:30:18 EST References: <5272@tektronix.UUCP> Reply-To: mwm@ucbtopaz.UUCP (Praiser of Bob) Organization: Missionaria Phonibalonica Lines: 19 In article <5272@tektronix.UUCP> paulh@tektronix.UUCP (Paul Hoefling) writes: >An inexperienced C programmer wrote a program containing the following: > x = x++; >Assuming that x originally had the value 5, what should the value be after >execution of the above expression ? Either 5 or 6, depending on the phase of the moon and the mood of the compiler. That expression, like such things as: y = funct(x, x++) ; y = &x ; x = funct((*y)++) ; and other, cuter problems, are indeterminate. If you want your code to be portable, you don't use such things. C is just full of goodies like this, but so are most other languages.