Re: Simple question

From: Alastair J Neil (ajn@essex.ac.uk)
Date: 12/13/95


Tel Janin Aellinsar wrote:
> 
> 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...
> 

Well if your compiler purports to be an ANSI compiler and supports some
other operator presednce then it is broken and you should complain
to the vendor.  Do you want to claim that because some compilers are
broken you can't write ansi complient code?

I'll admit that vendors tend to vary in how they handle "undefined"
behaviour and yes you will run into problems if you get in the habit
of passing null pointers to strcmp etc. because the DEC compiler let you.

-- 
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 Zeit...so wie Traenen im Regen.  Zeit zu sterben...



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