Path: utzoo!utgpu!water!watmath!clyde!rutgers!rochester!cornell!uw-beaver!uw-june!pardo From: pardo@uw-june.UUCP (David Keppel) Newsgroups: comp.lang.c Subject: Re: parens honored Keywords: ANSI C standard parens pragmas efficiency Message-ID: <3959@uw-june.UUCP> Date: 11 Jan 88 01:03:56 GMT References: <6829@brl-smoke.ARPA> <2845@zeus.TEK.COM> <6860@brl-smoke.ARPA> <7009@brl-smoke.ARPA> <7563@elsie.UUCP> Reply-To: pardo@uw-june.UUCP (David Keppel) Organization: U of Washington, Computer Science, Seattle Lines: 25 [ if you want to force evaluation order use temporaries ] 3 thoughts about this: (1) Super-optimizing compilers may get rid of the temporaries. (2) You can't always (easily) use temporaries when using macros. (3) Under ANSI-C, parens can be reordered as long as there isn't potential for overflow. To be able to exploit this effectively (to be able to freely rearrange parens almost everywhere, which is what you want), you need to be able to declare variables as being range-restricted: #define BUFSIZE 256 typedef /* some type goes here */ a_type; a_type pragma(range 0..BUFSIZE) i, j, k, l; so that i = j + (k - l); can be freely rearranged if a_type is 16 bits (or even unsigned 9), but not if it is 8 bits. ;-D on (Ada(TM) is NOT a trademark of dpANS!) Pardo