Wednesday, 7 August 2013

C header file dependencies

C header file dependencies

I would always typically include dependencies in my header files so that
when adding that header to a source file, I don't need to dig around for
the other required headers to make it compile.
However, after reviewing some other coding standards, it appears that this
is often banned, with the requirement that a header file will not contain
any #include statements.
I can't really find any discussion on this - so what would be the reason
for banning such a practice, or is it purely down to preference?
--
E.g. typedef.h contains a typedef for U8. my_header.h declares void
display_message(U8 arg);
Should the reference to typedef.h go into my_source_file.c or into
my_header.h ??

No comments:

Post a Comment