cvs commit: src/sys/dev/ep if_ep.c

Dag-ErlingSmørgrav des at des.no
Thu Oct 23 01:03:23 PDT 2003


"M. Warner Losh" <imp at bsdimp.com> writes:
> des at des.no (Dag-Erling Smørgrav) writes:
> > caddr_t is never right.  If it's a character pointer, use char *.
> Why not?  The rest of the driver uses it heavily, and the data type of
> the underlying mbufs is caddr_t:

Because the intention behind caddr_t was to be a "poor man's void *".
When used as "void *" it is patently wrong, and when used as "char *"
it is simply needless, unportable, obfuscating baggage.  If you mean
"char *", you should write "char *".

In fact, the use of caddr_t to mean char * in network code was *the*
major obstacle that made me stop trying to remove it wholesale from
the kernel, because it was hard to determine mechanically whether it
meant "void *" or "char *", and I ended up having to do it by hand.

DES
-- 
Dag-Erling Smørgrav - des at des.no


More information about the cvs-src mailing list