Re: [PATCH 1/8] CodingGuidelines: instruct to name arrays in singular
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Feb 19, 2026, 03:29 UTC
- Message-ID
- <CAPig+cRHm1vDABoHNKiuBRRsvk90Z1qGeeu3DT3VHdzEfJeP=g@mail.gmail.com>
- In-Reply-To
- <20260218211845.96009-2-lucasseikioshiro@gmail.com>
On Wed, Feb 18, 2026 at 4:20 PM Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> wrote:
Show 19 quoted lines
> Arrays should be named in the singular form, ensuring that when > accessing an element within an array (e.g. dog[0]) it's clear that > we're referring to an element instead of a collection. > > Add a new rule to CodingGuidelines asking for arrays to be named in > singular instead of plural. > > Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> > --- > diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines > @@ -656,6 +656,14 @@ For C programs: > + - Array names should be named in the singular form. E.g.: > + > + char *dog[] = ...; > + > + and not: > + > + char *dogs[] = ...; > +
While this is generally true on this project, it is nevertheless incomplete. More specifically, the singular form is used for an array name in cases when the individual items of the array are the typical subject of use, for instance, when the consumer of the array is walking the dogs one at a time. However, there are cases in which the array is generally employed as a whole, rather than as its unit parts, in which the plural form for the name is preferable. An example would be when walking all the dogs at the same time.