On Tue, Sep 7, 2010 at 12:13, Gary V. Vaughan <[email protected]> wrote: > Hi Tom, > > On 7 Sep 2010, at 23:49, Tom Browder wrote: > >> On Tue, Sep 7, 2010 at 11:16, Tom Browder <[email protected]> wrote: >>> On Tue, Sep 7, 2010 at 10:50, Gary V. Vaughan <[email protected]> wrote: >> ... >>> I have to say, though was that my initial excitement [for m4 capabilities] >>> was the >>> avoid-multiple-reading-of-header-files possibility more than anything >>> else. And that is still my interest (I see that is one of the >> >> Well, duh, I just found "#pragma once" in GNU cpp--the answer for that >> problem. I vaguely remember reading about it once but... > > Though I haven't checked the docs or the code, I have a pretty strong > conviction > that gcc is actually pretty smart without the pragma too... it remembers any > headers that are entirely contained in cpp guards (inside the header file), > and if it encounter another #include of the same file without a state change > in the guard macro, it ignores the #include and gets on with the rest of the > file.
Yes, I think that is pretty standard behavior. The difference I think is that the pragma results in the file not being opened again, thus saving a system call and possibly some perfomance gain over a large system.. The whole thing may be moot for practical purposes though, but it would be interesting to see some stats. -Tom
