Skip to content

Commit fdcdab3

Browse files
lucasoshirogitster
authored andcommitted
CodingGuidelines: instruct to name arrays in singular
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 02a0d29 commit fdcdab3

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Documentation/CodingGuidelines

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,14 @@ For C programs:
656656
unsigned other_field:1;
657657
unsigned field_with_longer_name:1;
658658

659+
- Array names should be named in the singular form. E.g.:
660+
661+
char *dog[] = ...;
662+
663+
and not:
664+
665+
char *dogs[] = ...;
666+
659667
For Perl programs:
660668

661669
- Most of the C guidelines above apply.

0 commit comments

Comments
 (0)