Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!ndsuvax!ncbauers From: ncbauers@ndsuvax.UUCP (Michael Bauers) Newsgroups: comp.lang.c Subject: b[a] = ++a; Message-ID: <533@ndsuvax.UUCP> Date: Sat, 5-Dec-87 11:47:21 EST Article-I.D.: ndsuvax.533 Posted: Sat Dec 5 11:47:21 1987 Date-Received: Sat, 12-Dec-87 06:32:37 EST Reply-To: ncbauers@ndsuvax.UUCP (Michael Bauers) Organization: North Dakota State University Fargo, ND Lines: 19 Statements in C of the type b[a] = ++a or similar types of of statements to the best of my knowledge would be implementation inde- pendent. It depends on whether the C compiler does all pre-increment/ decrement operations before expression evaluation, or during. e.g. 1) Preincrement 'a', then evaluate b[a] = a... or 2) figure out address of b[a], and then increment 'a' , and then assign 'a' to b[a]. Of course I may be very confused here...But this was what I think I was told by a man who used to work for Bell Labs (i.e. implementaion dependent) The solution is not to do this sort of thing. It is much, much better for sanity sake to do: ++a; b[a] = a; This way you KNOW what will happen, and you may not even cost yourself any extra machine cycles. The difference in speed would probably be negligable. Please correct me if I am wrong on this.