Re: [PATCH v1 2/3] Documentation/CodingStyle: do not use data type names as variable names
From: Jonathan Corbet
Date: Sat Mar 04 2023 - 10:01:54 EST
Wei Wang <wei.w.wang@xxxxxxxxx> writes:
> Observed some merged code uses "bool" as variable name. This is
> confusion either for the reader or compilier. Add a rule to have
> programmers avoid using data types as variable names.
>
> Signed-off-by: Wei Wang <wei.w.wang@xxxxxxxxx>
> ---
> Documentation/process/coding-style.rst | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst
> index 007e49ef6cec..6d7f4069d55d 100644
> --- a/Documentation/process/coding-style.rst
> +++ b/Documentation/process/coding-style.rst
> @@ -356,6 +356,9 @@ specification that mandates those terms. For new specifications
> translate specification usage of the terminology to the kernel coding
> standard where possible.
>
> +"bool", "int", "long" etc. are specific names for data types, C
> +programmers should not use them as variable names.
It seems you found one place where bool was being misused. Fixing it
was certainly the right thing to do, but I'm not convinced we need to
add clutter to the documentation for this.
Thanks,
jon