tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: [patch] put ptrdiff_t in the kernel and create sys/stddef.h
On Wed, Dec 04, 2013 at 01:54:56PM -0200, Lourival Vieira Neto wrote:
> >> > Why sys/stddef.h? Just keep them in sys/types.h please.
> >>
> >> To avoid redefining ptrdiff_t on stddef.h. I think it would be more
> >> coherent, since ptrdiff_t is a stddef.h definition and stddef.h
> >> shouldn't include sys/types.h.
> >
> > Weak reason. stddef.h must not include sys/types.h, but it doesn't mean
> > they can't both define it.
>
> I didn't state that it can't be defined by both. I just said it would
> be more coherent to define it in just one place. Why it is a bad idea?
Because doing it *right* is a bigger cleanup than you've done(*) and
the way consistent with the scheme already in place for handling these
issues is what Matt posted.
(*) A complete scheme for doing it right removes all the _BSD_FOO_T_
drivel and ifdefs scattered in userland headers in favor of:
- a single header file that defines all the needed types prefixed
with __, which can be included anywhere;
- in userland, include-guarded header files akin to sys/null.h
that define single or common groups of the names without the
__ prefixes, e.g. <types/size_t.h>;
- including these header files in the proper places, such as in
standard userland header files like stddef.h;
- in the kernel, a single header file that defines all the types
without the __, that is or is exposed to sys/types.h but does
not affect userland.
This is not a small undertaking; don't try it at home. :-/
It is also probably impossible to pull off cleanly until the
kernel/userland header namespace gets cleaned.
--
David A. Holland
dholland%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index