Re: Simple question

From: Tel Janin Aellinsar (icarus@loomis.berkshire.net)
Date: 12/13/95


On Wed, 13 Dec 1995, Alastair J Neil wrote:

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

No, I want to claim that some compilers support "extensions" that you 
have to shut off to get anything even remotely ANSI-complaint.  Of 
course, there is the occasional broken compiler, too.  From what BCC 
says, and I mostly agree, there are four style:  Kerighan and Ritchie, 
however their names are spelled;  ANSI C;  UNIX C;  and "everything 
else."  K&R C is not, AFAIK, ANSI C, and UNIX C sure as hell ain't ANSI 
C.  That isn't bad, because the ANSI C standard doesn't include some 
things that it should.

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

Well, I've never used a DEC compiler, but using pointers under DOS can 
sure get messy unless you're careful or use a 32-bit compiler.

___________________________________________________________________________
icarus@Crocker.COM                           http://www.crocker.com/~icarus
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