This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: local.h in scanf.c


Doug Evans wrote:
J. Johnston writes:
> local.h is just a local header file that is not externalized. It is also not > meant to be included multiple times. The C header files available to the > end-user have to be protected from multiple inclusion as some header files > include others and the end-user is not restricted from including them multiple > times. This is not the case for local.h.


That doesn't mean that one can't still protect local.h from multiple inclusion.

True.


Whether it is internal or external is irrelevant to the discussion.

Not true. An external C header file "has" to be protected. Legitimate user C code would not compile in some instances without such protection. An internal header file is only used by the internal code and does not have to satisfy flexible usage. The real questions to ask are: is there a legitimate scenario whereby the header file is included more than once or is there a scenario that a programmer can easily overlook and should be protected against. In this case, the answer is no to both questions. The header file is not included indirectly by any other header file and it is known only to the local C files. So, you only get it twice if you directly include it twice in the same source file which is a programming error, however insignificant.


-- Jeff J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]