Re: [PATCH v2 11/13] Add mention of header guards

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> From: Christophe de Dinechin <dinechin@xxxxxxxxxx>
> 
> Signed-off-by: Christophe de Dinechin <dinechin@xxxxxxxxxx>
> ---
>  docs/spice_style.txt | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/docs/spice_style.txt b/docs/spice_style.txt
> index 780f0615..e2465aa9 100644
> --- a/docs/spice_style.txt
> +++ b/docs/spice_style.txt
> @@ -357,6 +357,21 @@ char *array[] = {
>      "item_3",
>  };
>  
> +Headers
> +-------
> +
> +Headers should be protected against multiple inclusion using a macro that
> matches the header file name in uppercase, with all characters that are
> invalid in C replaced with an underscore '_':

Maybe is just me, I'm reading this like: if name is foo.h the guard is
FOO_H. Which actually is not entirely true as should just contain the "FOO_H"
(for instance in public headers is better to include the project in some way).
Maybe is just my definition of "matches".

> +
> +[source,h]
> +---
> +#ifndef MY_MODULE_H
> +#define MY_MODULE_H
> +
> +...
> +
> +#endif /* MY_MODULE_H */
> +---
> +

Are we suggesting C style only comment or is clear the is not important?
(I'm just drinking my first coffee this morning)

>  Header inclusion
>  ----------------
>  

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]