Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 exptools; site ihlpg.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!ihlpg!tainter From: tainter@ihlpg.UUCP (Tainter) Newsgroups: net.lang.c Subject: Re: *p++ = *p and more Message-ID: <1771@ihlpg.UUCP> Date: Thu, 3-Apr-86 18:46:38 EST Article-I.D.: ihlpg.1771 Posted: Thu Apr 3 18:46:38 1986 Date-Received: Sat, 5-Apr-86 11:22:35 EST References: <16634@rochester.ARPA> <139200024@uiucdcsb> Organization: AT&T Bell Laboratories Lines: 15 > I think compilers can do the post-increment anytime they feel like it > with in the statement. The semantics of a[i] = b[i++]; isn't > defined so the compiler can do whatever it wants. Even if that means > that both i's are evaluated before the increment is done. > Bill Smith > ihnp4!uiucdcs!wsmith According to K&R page 42 section 2.8 ....But the expression ++n increments n 'before' using its value, while n++ increments n after its value has been used. SO any time they feel like it is not valid. Indexing a[i] first or indexing b[i] first IS valid, but b is indexed with the value of i BEFORE i is incremented. a can be index either before or after i is incremented. --j.a.tainter