G
Gennaro Prota
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?
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?