Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Nov 1999 20:42:52 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Pierre Beyssac <beyssac@enst.fr>
Cc:        Garrett Wollman <wollman@khavrinen.lcs.mit.edu>, Sheldon Hearn <sheldonh@uunet.co.za>, freebsd-current@FreeBSD.ORG
Subject:   Re: egcs -O breaks ping.c:in_cksum()
Message-ID:  <Pine.BSF.4.10.9911162013400.1346-100000@alphplex.bde.org>
In-Reply-To: <19991116094536.A44999@enst.fr>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 16 Nov 1999, Pierre Beyssac wrote:

> On Tue, Nov 16, 1999 at 03:17:43PM +1100, Bruce Evans wrote:
> > On Mon, 15 Nov 1999, Pierre Beyssac wrote:
> > > -	volatile u_short answer = 0;
> > > +	union {
> > > +	    u_int16_t us;
> > > +	    u_int8_t  uc[2];
> > > +	} answer;
> > 
> > This has indentation bugs.
> 
> Uh, which one(s) do you mean exactly? The 4-space indented union
> (I just followed style(9)) or the double space before uc[2] (it
> was just to align us and uc vertically)?

See Sheldon's reply.  u_int16_t and u_int8_t are too wide for the
normal indentation rules to apply.  Various inconsistent formattings
are used for them.  E.g., in Lite2, <ufs/ufs/dir.h> uses an extra space
in one struct and an extra tab in the others.  This is another reason
to use u_short :-).

> > ping.c still assumes that u_short is u_int16_t everywhere else.
> 
> But in_cksum() is more or less self-contained. Probably it's more
> consistent (even withing in_cksum which uses u_short elsewhere) to
> change back the union to u_short and u_char, though.

There are better examples to copy in the kernel.  They still use too
many shorts, ints and union hacks, however.  The alpha version is
most interesting.

Bruce



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9911162013400.1346-100000>