List:Internals« Previous MessageNext Message »
From:Kristian Nielsen Date:October 2 2009 8:13am
Subject:Re: [style] Proposal for include guard naming and usage
View as plain text  
Mats Kindahl <mats@stripped> writes:

> I have a proposal for rules regarding the naming and usage of include guard. I
> see currently in the code include guards missing, but also used in odd ways that
> makes it more difficult to automatically check header files for missing include
> guards.

Sounds good!

> - Include guards shall be of the form ``PACKAGE_HEADER_INCLUDED``,
>   that is: the package name followed by the base file name (excluding
>   the extension) in all capital letters, numbers, and underscores. The
>   package name and the header name is separated by an underscore.

> The extension is omitted because there are different naming
> conventions (.h, .hh, .hpp) and the choice of naming convention for
> header files should not affect the include guard name.

$ find . -name '*.h' -o -name '*.hpp' -o -name '*.ic' | xargs egrep '^#define.*_H'|wc -l
1735
$ find . -name '*.h' -o -name '*.hpp' -o -name '*.ic' | xargs egrep
'^#define.*_INCLUDED'|wc -l
9

Please do not change the existing code style without good reason. Clearly the
current style is using _H, not _INCLUDED, and _H will be as easy for
developers to undestand as _INCLUDED, no matter the name of the file.

So let's keep PACKAGE_HEADER_H, please?

Thanks,

 - Kristian.
Thread
[style] Proposal for include guard naming and usageMats Kindahl2 Oct
  • Re: [style] Proposal for include guard naming and usageKristian Nielsen2 Oct
    • Re: [style] Proposal for include guard naming and usageMats Kindahl2 Oct
      • Re: [style] Proposal for include guard naming and usageMats Kindahl19 Oct
        • Re: [style] Proposal for include guard naming and usageIngo Strüwing19 Oct
          • Re: [style] Proposal for include guard naming and usageMats Kindahl19 Oct
            • Coding style committee [Re: [style] Proposal for include guard namingand usage]Ingo Strüwing19 Oct
              • Re: Coding style committee [Re: [style] Proposal for include guardnaming and usage]Mats Kindahl20 Oct
                • Re: Coding style committee [Re: [style] Proposal for include guardnaming and usage]Jay Pipes20 Oct
                  • Re: Coding style committee [Re: [style] Proposal for include guardnaming and usage]Ingo Strüwing20 Oct
                    • Re: Coding style committee [Re: [style] Proposal for include guardnaming and usage]Jay Pipes20 Oct