Subject: Re: caddr_t removal Q
To: glen mccready <gkm+nb@petting-zoo.net>
From: Christos Zoulas <christos@zoulas.com>
List: tech-kern
Date: 03/13/2007 14:20:46
On Mar 13, 11:09am, gkm+nb@petting-zoo.net (glen mccready) wrote:
-- Subject: Re: caddr_t removal Q

| christos wrote:
| > Allen Briggs  <briggs@netbsd.org> wrote:
| > >What's wrong with having a generic pointer type that it's safe to do
| > >byte-wise arithmetic on (which is what I've considered caddr_t to be)?
| > 
| > That is the problem "char *" (caddr_t) is not a generic pointer. The API's
| > that wanted generic pointers should have had "void *" not "caddr_t".
| > "caddr_t" predates "void" in `c', so back then it was used as a generic
| > pointer for the lack of something better. Now we have something better
| > and we should be using it.
| 
| So now you're relying on the brokenness of gcc allowing you
| to perform arithmetic operations on a `void *' instead?

No, we cast or assign to the appropriate pointer type when we want
to do arithmetic; this is where most of the "breakage" that needed
fixing came from.  All kernels are compiled with -Wpointer-arith.

christos