On Wed, Feb 24, 2010 at 07:27:27PM -0700, Theo de Raadt wrote:
> > That said, sys/types.h is most likely not what is needed to
> > make sys/mman.h self-contained, but that's a completely
> > separate issue.
> 
> By the way, where is it written that sys/mman.h has to be
> self-contained?
> 
> I bet it is written exactly the other way around.

http://www.opengroup.org/onlinepubs/9699919799/

E.g. sys/mman.h is supposed to define size_t. The easiest approach for
that is to include sys/types.h, but adding e.g.
#ifndef _SIZE_T_DEFINED_
#define _SIZE_T_DEFINED_
typedef __size_t        size_t;
#endif
is acceptable (and preferable). The goal beside the standalone
requirement is to enforce minimal pollution of the application
namespace. If a source file needs a symbol from foo.h, it should have to
include it, but it shouldn't have to know how the headers work
internally.

Joerg

Reply via email to