By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,897 Members | 1,955 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,897 IT Pros & Developers. It's quick & easy.

Comments outside include guards (from a Sutter/Alexandrescu advice)

P: n/a
Hi,

after several "tweaks" I think I've finally found a file layout which
I like for my code (in terms of where the copyright line and the
license reference go, where the vim modeline etc.). For included
files, I've stuck so far to the suggestion in C++ Coding Standards
which says:

Don't try to be clever: Don't put any code or comments before
and after the guarded portion, and stick to the standard form
as shown. Today's preprocessors can detect include guards, but
they might have limited intelligence and expect the guard code
to appear exactly at the beginning and end of the header.

but with my final layout having the include guard outside of
everything looks a bit ugly. No big deal, but I'm curious to know if
there are really compilers which get fooled by comments outside the
guard. The documentation for gcc explicitly says

You can put comments outside the wrapper. They will not
interfere with this optimization.

so one point for it :-) What about others?

--
Gennaro Prota -- C++ Developer, For Hire
https://sourceforge.net/projects/breeze/
(replace 'address' with 'name.surname' to mail)
Jun 6 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.