Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: net.lang.c Subject: Re: *p++ = *p results? Message-ID: <2034@brl-smoke.ARPA> Date: Mon, 24-Mar-86 01:12:59 EST Article-I.D.: brl-smok.2034 Posted: Mon Mar 24 01:12:59 1986 Date-Received: Wed, 26-Mar-86 04:27:58 EST References: <312@imagen.UUCP> Reply-To: gwyn@brl.ARPA Distribution: net Organization: Ballistic Research Lab (BRL) Lines: 15 In article <312@imagen.UUCP> kevin@imagen.UUCP (Kevin L. Malloy) writes: >In the statement *p++ = *p; what will be the result? Will p be equal >to itself or will p be equal to the next value it is pointing to? >In other words should p be incremented after it is evaluated or should >p be incremented after the assignment operation is finished?-- Obviously `p' equals itself! I will assume you mean "does `p' point to the next value after the one `p' initially pointed to?" The technically correct answer is, `p' must be incremented by the time the next "sequence point" (defined by X3J11) is reached. My copy of the draft standard is not at hand at the moment, but I believe there is no sequence point until after the assignment. That would mean that either result is legal; in other words, don't write code like this.