Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ames!hc!hi!josh From: josh@hi.uucp (Josh Siegel ) Newsgroups: comp.lang.c Subject: Stupid evaluation ordering. Is this legal? Message-ID: <4395@hi.uucp> Date: Fri, 17-Apr-87 17:45:31 EST Article-I.D.: hi.4395 Posted: Fri Apr 17 17:45:31 1987 Date-Received: Sun, 19-Apr-87 13:12:56 EST Organization: Univ. of New Mexico, Albuquerque Lines: 36 Keywords: K&R, Bible, PCs, UNIX I just lost a argument and am running to the net for comfort... According to K&R(Bible) page 185, a C compiler is allowed to do the following. Given: a(b()+c(),d()+e()) It is allowed to run functions b() and d(), then run c() and e(), THEN add them (This has shades of compilers that optimise on parallel machines). This causes problems with stuff like: . . . struct foobar *getit(); doit(getit(5)->foo1, getit(7)->foo5) . . . When getit() returns a pointer to a internal static buffer. Should it be allowed to do this? yes yes.. I know I should just use a temp var but thats not the point! Whine!!! Sigh... -- Josh Siegel (siegel@hc.dspo.gov) (505) 277-2497 (Home) I'm a mathematician, not a programmer!