Hello,

Milos Nikic, le ven. 10 avril 2026 21:21:58 -0700, a ecrit:
> Regarding the headers: I come from a background where "Include What You Use"
> (IWYU) is strictly enforced for stability, so my instinct is to strip away
> "kitchen sink" headers and make every dependency explicit.
> 
> However, it sounds like this codebase prefers using umbrella headers and
> relying on transitive resolution

In some cases, yes.

It can be for types reasons: if you use a function that returns a
kern_return_t, well, yes, surely the header that defines that type has
to get included by the header tha declares that function. That's why
you'd essentially never really need to include <sys/types.h>

Then there are a couple of meta-headers such as <mach.h> which are
really meant to include others.

And then there can indeed be some opportunistic includes: e.g. <hurd.h>
happens to include <errno.h> (for some extern inlines), but includers of
<hurd.h> should still include <errno.h> themselves if they want to get
E* macros.

Samuel

Reply via email to