On 2025-06-11 22:51:38-04:00, Wietse Venema via Postfix-devel wrote:
Wietse Venema via Postfix-devel:
Richard Hansen via Postfix-devel:
argv.h references ssize_t.  vstream.h references WAIT_STATUS_T.
---
A technique I use to ensure that every header is self-contained is to always
have a corresponding .c for each .h (even if otherwise unnecessary, e.g.,
macro-only headers), and include the corresponding .h before including anything
else.

[adding '#include <sys_defs.h>" lines at the top of a header file]

Agreed, but I don't have the time to redo that with > 1000 files, 25+ years
after the initial imolementation was done.

Sorry, I didn't intend it as a criticism -- only as a suggestion that might benefit new .h and .c files, or as a gradual de-linting practice when touching includes for unrelated reasons.


The patch is adopted.

And reverted, because every Postfix .h file is included
after the .c file has already included <sys_defs.h>.

The story behind this patch: I am working on another feature that I want to propose to you and the rest of the community when the PoC is ready. This new feature involves new .h and .c files. I ran into compiler errors because my personal coding habit is to include the corresponding .h at the top of the .c file, and the new .h file includes argv.h and vstream.h (indirectly). I didn't expect this patch to be controversial, so I didn't include more rationale in the commit message.

For a new foo.c file, would you prefer its `#include "foo.h"` line to be mixed in with the other Postfix includes for consistency with the existing codebase? My personal preference is to put it at the top, but there's a lot of value in consistency, and I want to follow the style you prefer.

Thanks,
Richard
_______________________________________________
Postfix-devel mailing list -- postfix-devel@postfix.org
To unsubscribe send an email to postfix-devel-le...@postfix.org

Reply via email to