Author: Dieter Buerssner
Date: 09:18:58 02/08/04
Go up one level in this thread
On February 08, 2004 at 10:29:19, Uri Blass wrote: >On February 08, 2004 at 09:59:37, Sune Fischer wrote: >>You must do the cast before the operation, ie. if you do something like: >> >>int x=...,y=...; >>__int64 f = x*y; >> >>it will not produce a __int64 result, similarly for a shift operation. > >Yes and I think that it is a mistake in defining the standard C behaviour. I disagree. It would be very difficult, to write efficient code in many cases, then. On some hardware/environments that multiplication cold take much longer with your rule - even when the programmer really knew, that the multiplication does not overflow in int arithmetics. I assume, the language creators thought about this well. Also think at other examples: int x, y; double f = x/y; Would you really want to do a floating point division here? How about f=x/y+0.5? Regards, Dieter
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.