Re: Simple question

From: Tel Janin Aellinsar (
Date: 12/12/95

On Tue, 12 Dec 1995, Alastair J Neil wrote:

> thus spake d hall
> >Michael> I don't know if this works, but even if it does it's not the best
> >Michael> way.  Try something like
> >
> >it does work with GCC, since it's smart enough to implicitly typecast.
> >
> >Michael> ch->player.height = ch->player.height * 3 / 4;
> >
> >this might save the work of typecasting, but it varies based upon the
> >platform and compiler.
> why should this vary from platfom and compiler?  The precedence of
> operators is defined in the ansi standard.

And since when has any C compiler followed completely the ANSI standard?

Most have the option of turning a lot on, but I don't think even gcc, 
which is pretty standardized, goes all-out ANSI, even on request...

> Michael> for faster code and code that is sure to work (fastest would be to
> Michael> use a bit shift after the multiply).  By the way, don't mess with
> Michael> the order of operations by adding ()'s.  To work right this has to
> Michael> perform the *3 before the /4.
> yes, this would seem to be the most portible.
> -- 
> Ich habe Dinge gesehen, die ihr Menschen niemals glauben wuerdet. Gigantische
> Schiffe, die brannten draussen vor der Schulter des Orion. Und ich habe C-Beams  
> gesehen - glitzernd im Dunkeln nahe dem Tannhaeuser Tor. All diese Momente 
> werden verloren sein in der wie Traenen im Regen.  Zeit zu sterben...

Yes.  Next Tuesday.

Berserker Dragon -=={UDIC}==-              Ultima Dragons, Internet Chapter
Lord Eric P. McCoy IV                                 Knights of the Cosmos

This archive was generated by hypermail 2b30 : 12/07/00 PST