Subject: Re: duplicate members fix on Solaris Netatalk
From: Dejan Ilic (svedja@morgaine.rydnet.lysator.liu.se)
Date: Fri Jun 20 1997 - 20:05:32 EDT
On Fri, 20 Jun 1997, Bill Studenmund wrote:
> On Sat, 21 Jun 1997, Dejan Ilic wrote:
>
> > ddp.h is missing a "#include <endian.h>"
> >
> > and thus "BYTE_ORDER == BIG_ENDIAN" would mean "0 == 0" because non of
> > them would be defined, and that is equal. Very dangerous and nasty bug.
> > Same for little_endian check.
>
> Shouldn't it actually be "BYTE_ORDER == BIG_ENDIAN" becomes " == " which
> is a syntax error???
Well, GCC 2.7.2.2 passes that line as no error has happend. Maybe another
compiler would have triggered a error there but not GCC. I dont have
Sun-CC to check what happends on another compiler.
Anyway including "#include <endian.h>" makes the problem dissapear.
> Also, I thought that all the include files were arranged so that endian.h
> got included anyway. I.E. if a file includes ddp.h, it should be including
> endian.h anyway.
As you can see it doesn't, at least no the "dpp.h" in solaris directory. I
complained about the existance of several files with the same name in
different directorys. It is maybe correct in another directory.
> On NetBSD, on an i386, machine/endian.h says:
>
> #define LITTLE_ENDIAN 1234
> #define BIG_ENDIAN 4321
> #define PDP_ENDIAN 3412
>
> #define BYTE_ORDER LITTLE_ENDIAN
>
> on an m68k NetBSD machine, only the last define is changed. So both
> BIG_ENDIAN and LITTLE_ENDIAN are defined on both.
>
> Checking to make sure BYTE_ORDER is defined is better.
Agreed. That would be best.
=====================================================================
Dejan Ilic, Tech Univ. of Linkoping, Sweden Phone: +46-13-473 01 06
Email: svedja@lysator.liu.se Web: http://www.lysator.liu.se/~svedja
"I may look like The Devil but i'm an angel deep down in my heart"
=====================================================================
[finger -l svedja@lysator.liu.se for public PGP key]
This archive was generated by hypermail 2b28 : Sat Dec 18 1999 - 16:25:06 EST