Subject: Re: kern/34751: regular panics in tcp_sack_option on NetBSD/alpha 3.0_STABLE
To: None <netbsd-bugs@NetBSD.org>
From: Christian Biere <christianbiere@gmx.de>
List: netbsd-bugs
Date: 10/20/2006 15:40:36
Izumi Tsutsui wrote:
> reinoud@NetBSD.org wrote:
> > Only point of improval could be the usage of `uint8_t' instead of `char'
> > since that has an implicit assumption that sizeof(char)=1.
> I chose (char *) because (IIRC) it is explicitly mentioned in ISO C89
> that it won't cause aliases. (I think sizeof(char) is always 1, BTW)
Yes, sizeof(char) is guaranteed to yield 1. However, that tells you nothing
about the bitwidth of char. The types char, int, long may all be aliases for
the same integer type, for example, a 36-bit integer. Untyped memory is best
passed around using void pointers. "char *" is fine too for backwards
compatibility but often requires explicit casts to avoid compiler warnings.
--
Christian