[PATCH v4 01/12] CODING_STYLE: Custom type names must be snake-cased by word.

Alejandro Vallejo posted 12 patches 4 months, 1 week ago
There is a newer version of this series
[PATCH v4 01/12] CODING_STYLE: Custom type names must be snake-cased by word.
Posted by Alejandro Vallejo 4 months, 1 week ago
There's the unwritten convention in x86 of splitting type names using
underscores. Add such convention to the CODINNG_STYLE to make it
common and less unwritten.

Signed-off-by: Alejandro Vallejo <agarciav@amd.com>
---
v4:
  * Move new paragraph into a new "Identifiers" section
---
 CODING_STYLE | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/CODING_STYLE b/CODING_STYLE
index 5644f1697f..7bf3848444 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -113,6 +113,12 @@ Braces should be omitted for blocks with a single statement. e.g.,
 if ( condition )
     single_statement();
 
+Identifiers
+-----------
+
+When giving names to identifiers (variables, functions, constants...), separate
+words using underscores (for example, use "my_foo" instead of "myfoo").
+
 Types
 -----
 
-- 
2.43.0
Re: [PATCH v4 01/12] CODING_STYLE: Custom type names must be snake-cased by word.
Posted by Jan Beulich 4 months, 1 week ago
On 20.06.2025 20:28, Alejandro Vallejo wrote:
> There's the unwritten convention in x86 of splitting type names using
> underscores. Add such convention to the CODINNG_STYLE to make it
> common and less unwritten.

Just curious: How does x86 come into play here? Xen inherited this un-
written rule from Linux, afaict.

Jan
Re: [PATCH v4 01/12] CODING_STYLE: Custom type names must be snake-cased by word.
Posted by Alejandro Vallejo 4 months, 1 week ago
On Mon Jun 23, 2025 at 9:31 AM CEST, Jan Beulich wrote:
> On 20.06.2025 20:28, Alejandro Vallejo wrote:
>> There's the unwritten convention in x86 of splitting type names using
>> underscores. Add such convention to the CODINNG_STYLE to make it
>> common and less unwritten.
>
> Just curious: How does x86 come into play here? Xen inherited this un-
> written rule from Linux, afaict.
>
> Jan

x86 follows the rule far more strictly than other Xen ports. Even in Linux it's
not uncommon to see some words stashed together because they represent a single
concept. e.g: "bootmode", "bootram", "bootmod", "bootaddr", etc. Some of them
inherited by Xen itself, like "softirq".

But I digress. I mentioned x86 because it's the most traceable use of the rule
as written in CODING_STYLE in this patch.  When or why you decided to do so is
another matter entirely which I very definitely do not know.

If you feel the commit message should be something else, I'm happy for it to be
such something else.

Cheers,
Alejandro
Re: [PATCH v4 01/12] CODING_STYLE: Custom type names must be snake-cased by word.
Posted by Stefano Stabellini 4 months, 1 week ago
On Fri, 20 Jun 2025, Alejandro Vallejo wrote:
> There's the unwritten convention in x86 of splitting type names using
> underscores. Add such convention to the CODINNG_STYLE to make it
> common and less unwritten.
> 
> Signed-off-by: Alejandro Vallejo <agarciav@amd.com>

Acked-by: Stefano Stabellini <sstabellini@kernel.org>

> ---
> v4:
>   * Move new paragraph into a new "Identifiers" section
> ---
>  CODING_STYLE | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/CODING_STYLE b/CODING_STYLE
> index 5644f1697f..7bf3848444 100644
> --- a/CODING_STYLE
> +++ b/CODING_STYLE
> @@ -113,6 +113,12 @@ Braces should be omitted for blocks with a single statement. e.g.,
>  if ( condition )
>      single_statement();
>  
> +Identifiers
> +-----------
> +
> +When giving names to identifiers (variables, functions, constants...), separate
> +words using underscores (for example, use "my_foo" instead of "myfoo").
> +
>  Types
>  -----
>  
> -- 
> 2.43.0
>