() ignored in some expressions

Jens Tingleff jensting at skinfaxe.diku.dk
Tue Apr 10 16:13:33 AEST 1990

karl at haddock.ima.isc.com (Karl Heuer) writes:

>In article <48079 at lanl.gov> u096000 at lanl.gov (Roger A. Cole) writes:


>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?

Ahemm. Am I stupid, or is the result of 1000*(1000 - 999) quite dependant
on the parenthesis being done properly (assume 16 bit int's..)? Granted 
that unsigned int math shouldn't give an overflow exception, you might get
it right there. But with signed int, giving overflow exceptions, you'd be
in real trouble. Change the above to 1000*(999 - 1000) if you like.. .

Of course, with floating point, the problems might be worse, e.g. optimisation
changing the result of a valid and reasonable program.. .


jensting at diku.dk is
Jens Tingleff MSc EE, Research Assistent at DIKU
	Institute of Computer Science, Copenhagen University
Snail mail: DIKU Universitetsparken 1 DK2100 KBH O

More information about the Comp.lang.c mailing list