Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

C++ Programming

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


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)

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc