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:
 > Not true.  An external C header file "has" to be protected.

I left that as a given. C'mon.

> So, you > only get it twice if you directly include it twice in the same source file which > is a programming error, however insignificant.

That's a stretch.
Over time who knows how the code might evolve.
The practice of always protecting headers (that aren't intended to
be included multiple times) means one less nuisance to deal with.

I'm not trying to start a battle. Artem asked why the header file didn't have protection to start with. The reason is that it was an internal header file written to satisfy some immediate need to the local C files. It wasn't included indirectly and didn't require protection then or now as the previous double inclusion was not causing an error. Artem only found a problem because he did his own local alteration of the header file. His change is not posted. I would have expected any post from him to have fixed his problem one way or another.


I am not opposed to having header files protected. It is a wise practice to prepare for future change, but it is not always required. The newlib local header files are, for the most part, not protected and that's the state of things. I contend they are doing what they were intended to do and there is a very low probability that they will ever need to prepare for multiple inclusion. The one case of multiple inclusion thus far was a programmer error in scanf.c; local.h has been around since 1992. I can't say how code will evolve, but I am prepared to make changes as needed to ensure newlib builds correctly. To go through now and change all the local header files is IMO an unnecessary task.

-- Jeff J.


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