diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-11-08 12:56:25 +0900 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-11-08 12:56:26 +0900 |
| commit | c14fa9a511bdb46dbc760924e9383fda78e7677d (patch) | |
| tree | 63e36ed39d46bfaa8a4a4edf435323412c5b1cae /Documentation/CodingGuidelines | |
| parent | 8f8d6eee531b3fa1a8ef14f169b0cb5035f7a772 (diff) | |
| parent | be75cec1b62b9f873c7fc50bbaff3002d82ab458 (diff) | |
| download | git-c14fa9a511bdb46dbc760924e9383fda78e7677d.tar.gz | |
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
Diffstat (limited to 'Documentation/CodingGuidelines')
| -rw-r--r-- | Documentation/CodingGuidelines | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index 30fda4142c..87904791cb 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -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. |
