Re: Homogenizing include guards - and copyright comments
Max Bowsher wrote: OK, I've committed the bulk of these changes - that is, all files which have both and inclusion guard and a standard-form copyright comment. Here are some comments on the remainder: md5.h rfc1738.h: Imported from elsewhere, so I'm not changing them. Cool. resource.h: Special case - not changing. Fine. LogFile.h cistring.h dialog.h diskfull.h filemanip.h geturl.h hash.h log.h mkdir.h mount.h msg.h netio.h nio-file.h nio-ftp.h nio-http.h nio-ie5.h port.h simpsock.h state.h version.h: No include guard. Please add. root.h: No copyright comment. Grep CVS annotate for a list of editors && || the Changelog for the file name. (If we are going to put a list of copyrights in, it should be correct:}) mklink2.h: Neither copyright comment, nor include guard. Ditto. I propose to add include guards and copyright comments as mentioned above. Thanks again, please see above for my suggestions. Rob
Re: Homogenizing include guards - and copyright comments
Robert Collins wrote: > Max Bowsher wrote: ... >> Whilst I'm tidying up the names of the include guards, I might as well tidy >> up the locations of the include guards (with respect to the comments at the >> start of the file). Is this ordering OK? : ... > Please do - this is fine. OK, I've committed the bulk of these changes - that is, all files which have both and inclusion guard and a standard-form copyright comment. Here are some comments on the remainder: md5.h rfc1738.h: Imported from elsewhere, so I'm not changing them. resource.h: Special case - not changing. LogFile.h cistring.h dialog.h diskfull.h filemanip.h geturl.h hash.h log.h mkdir.h mount.h msg.h netio.h nio-file.h nio-ftp.h nio-http.h nio-ie5.h port.h simpsock.h state.h version.h: No include guard. root.h: No copyright comment. mklink2.h: Neither copyright comment, nor include guard. I propose to add include guards and copyright comments as mentioned above. What name should appear in the copyright comments? Max.
Re: Homogenizing include guards - and copyright comments
On Sat, 21 Jun 2003 21:23:44 +0100 Max Bowsher wrote: > Benjamin Riefenstahl wrote: > > From his example and as this discussion is in cygwin-apps, I thought > > Max was talking about setup.exe and/or similar stuff, which is > > user-level, non-"implementation" code AFAICS. > No, exactly right. As setup is an application, not a library, it is free to > use its namespace in any way it sees fit. Right, I was in the wrong context.
Re: Homogenizing include guards - and copyright comments
Benjamin Riefenstahl wrote: > Hi Glenn, Max, > > > Glenn Fowler <[EMAIL PROTECTED]> writes: >> implementation specific symbols, e.g. include guards, should begin >> with '_' to avoid namespace pollution > > Pardon me if I try to clarify: By "implementation" you probably mean > the compiler headers, like , including POSIX headers like > , and possibly also including the Windows API headers. > > From his example and as this discussion is in cygwin-apps, I thought > Max was talking about setup.exe and/or similar stuff, which is > user-level, non-"implementation" code AFAICS. > > Or I may be missing something ... No, exactly right. As setup is an application, not a library, it is free to use its namespace in any way it sees fit. Max.
Re: Homogenizing include guards - and copyright comments
Hi Glenn, Max, Glenn Fowler <[EMAIL PROTECTED]> writes: > implementation specific symbols, e.g. include guards, should begin > with '_' to avoid namespace pollution Pardon me if I try to clarify: By "implementation" you probably mean the compiler headers, like , including POSIX headers like , and possibly also including the Windows API headers. >From his example and as this discussion is in cygwin-apps, I thought Max was talking about setup.exe and/or similar stuff, which is user-level, non-"implementation" code AFAICS. Or I may be missing something ... benny
Re: Homogenizing include guards - and copyright comments
On Fri, 20 Jun 2003 17:52:14 +0100 Max Bowsher wrote: > I'm about to do the include guard cleanup I mentioned some time ago. implementation specific symbols, e.g. include guards, should begin with '_' to avoid namespace pollution -- Glenn Fowler <[EMAIL PROTECTED]> AT&T Labs Research, Florham Park NJ --
Re: Homogenizing include guards - and copyright comments
Max Bowsher wrote: Off-list (presumably accidentally), Gary R. Van Sickle replied: I tend to think that the include guards should wrap as much of the file as possible, idea being that the compiler then bypasses the most text possible. But then again, rumor has it that gcc (at least) recognizes such constructs and doesn't even rescan the file at all the second time, and scanning is hardly the bottleneck in gcc these days I don't think the extra copyright comments will have much of an effect on compilation speed. I like the layout I proposed, because it gives increased visual distinction between copyright boilerplate and file-specific interesting info. I too like this aspect of the layout. Additionally, recall that C / C++ compilers generally run in (at least) two parts: a pre-processor (cpp) that generates a single macro-expanded source files, and then the actual source->(object|assembly). The smarts of the cpp program are what drive the overhead of repeated includes. A naive one will scan every include fully into memory, and the process through the #if's. A smarter one will calculate as it goes, and once it hits a #if start skipping code... My point is that a dumb one will, if header FOO is included 3 times, have three complete copies of FOO in memory before it's #if resolution pass. A smart one that only keeps one copy of FOO, and 2 copies of the comments is already so much faster :} Rob
Re: Homogenizing include guards - and copyright comments
Max Bowsher wrote: I'm about to do the include guard cleanup I mentioned some time ago. Whilst I'm tidying up the names of the include guards, I might as well tidy up the locations of the include guards (with respect to the comments at the start of the file). Is this ordering OK? : - /* * Copyright (c) . * . * */ #ifndef SETUP_FOOBAR_H #define SETUP_FOOBAR_H /* (In some files) Brief description of file. */ rest-of-file #endif /* SETUP_FOOBAR_H */ Please do - this is fine. Rob
Re: Homogenizing include guards - and copyright comments
Max Bowsher wrote: >> I'm about to do the include guard cleanup I mentioned some time ago. >> >> Whilst I'm tidying up the names of the include guards, I might as well tidy >> up the locations of the include guards (with respect to the comments at the >> start of the file). Is this ordering OK? : >> >> - >> /* >> * Copyright (c) . >> * . >> * >> */ >> >> #ifndef SETUP_FOOBAR_H >> #define SETUP_FOOBAR_H >> >> /* (In some files) Brief description of file. */ >> >> rest-of-file >> >> #endif /* SETUP_FOOBAR_H */ >> Off-list (presumably accidentally), Gary R. Van Sickle replied: > I tend to think that the include guards should wrap as much of the file as > possible, idea being that the compiler then bypasses the most text possible. > But then again, rumor has it that gcc (at least) recognizes such constructs and > doesn't even rescan the file at all the second time, and scanning is hardly the > bottleneck in gcc these days I don't think the extra copyright comments will have much of an effect on compilation speed. I like the layout I proposed, because it gives increased visual distinction between copyright boilerplate and file-specific interesting info. Max.