Path: utzoo!attcan!uunet!mcsun!hp4nl!orcenl!bengsig From: bengsig@oracle.nl (Bjorn Engsig) Newsgroups: comp.lang.c Subject: Re: () ignored in some expressions Message-ID: <628@nlsun1.oracle.nl> Date: 10 Apr 90 15:23:58 GMT References: <48079@lanl.gov> <16414@haddock.ima.isc.com> Reply-To: bengsig@oracle.nl (Bjorn Engsig) Organization: Oracle Europe, The Netherlands Lines: 19 Article <16414@haddock.ima.isc.com> by karl@haddock.ima.isc.com (Karl Heuer) comments why K&R 1 allowed C compilers to rearrange parnthesized expression as long as it mathematically was the same: | |Optimization. With unsigned integers (and also signed integers in the usual |implementation), you get exactly the same answer anyway, so why not explicitly |allow it? In the university, I did a lot of floating point/numerical programming in fortran, and learned by heart that calculation order does matter. Therefore I added a bunch of !'s in my K&R 1 when I saw that the C compiler could rearrange, and I still think it's more a bug than a feature. Fortunately, this is now gone in ANSI C as you also point out, Karl: |The places where it's useful are already covered by the as-if rule. The as if rule could have done better in K&R 1, since it clearly excludes rearrangning of float calculations, but (normally) not integer. -- Bjorn Engsig, Domain: bengsig@oracle.nl, bengsig@oracle.com Path: uunet!mcsun!orcenl!bengsig