Merge branch 'kn/arbitrary-suffixes'

Update the project's CodingGuidelines to discourage naming functions
with a "_1()" suffix.

* kn/arbitrary-suffixes:
  CodingGuidelines: discourage arbitrary suffixes in function names
This commit is contained in:
Junio C Hamano
2024-11-08 12:56:25 +09:00

View File

@ -621,6 +621,20 @@ For C programs:
- `S_free()` releases a structure's contents and frees the
structure.
- Function names should be clear and descriptive, accurately reflecting
their purpose or behavior. Arbitrary suffixes that do not add meaningful
context can lead to confusion, particularly for newcomers to the codebase.
Historically, the '_1' suffix has been used in situations where:
- A function handles one element among a group that requires similar
processing.
- A recursive function has been separated from its setup phase.
The '_1' suffix can be used as a concise way to indicate these specific
cases. However, it is recommended to find a more descriptive name wherever
possible to improve the readability and maintainability of the code.
For Perl programs:
- Most of the C guidelines above apply.