casts and assignments

Chris Torek chris at mimsy.umd.edu
Wed Dec 6 01:08:07 AEST 1989


[someone's question about  a = (type of 'a') (expression);
 and my reply deleted]

In article <3979 at vax1.tcd.ie> mbrennan at vax1.tcd.ie writes:
>int i ;
>int j ;
>long l ;
>
>	l = i * j ;
>	l = (long) i * j ;

>I realise I may be answering a slightly different question than you posed, 
>but ...

You are: the latter is not

	l = (long) (i * j);

but rather

	l = (long) i * j;

which binds as

	l = ((long) i) * j;

Hoping to stem the oncoming tide of confusion (not to mention the
oncoming rerun of how `long=short*short' is the [incorrect] way to
get fast multiplies out of a handful of 680x0 compilers that do
things the hard way for `long=(long)short*short'),
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list