diff options
| author | Junio C Hamano <gitster@pobox.com> | 2026-04-08 10:19:17 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-04-08 10:19:17 -0700 |
| commit | 9797fed6cea706f65de64396222545d545226e15 (patch) | |
| tree | 04ffa4091726ad86bf0d764a75487395e5859cf4 /Documentation/CodingGuidelines | |
| parent | 2e3028a58c1f1fbf08538443fc30a48ac4f6bacf (diff) | |
| parent | 109bcb7d1d2f0d2f0514beec15779190c0b89575 (diff) | |
| download | git-9797fed6cea706f65de64396222545d545226e15.tar.xz | |
Merge branch 'ps/odb-cleanup'
Various code clean-up around odb subsystem.
* ps/odb-cleanup:
odb: drop unneeded headers and forward decls
odb: rename `odb_has_object()` flags
odb: use enum for `odb_write_object` flags
odb: rename `odb_write_object()` flags
treewide: use enum for `odb_for_each_object()` flags
CodingGuidelines: document our style for flags
Diffstat (limited to 'Documentation/CodingGuidelines')
| -rw-r--r-- | Documentation/CodingGuidelines | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index b8670751f5..4992e52093 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -668,6 +668,18 @@ For C programs: unsigned other_field:1; unsigned field_with_longer_name:1; + - When a function `F` accepts flags, those flags should be defined as `enum + F_flags`. Individual flag definitions should start with `F` and be in + all-uppercase letters. Flag values should be represented via bit shifts. + E.g. + + enum frobnicate_flags { + FROBNICATE_FOO = (1 << 0), + FROBNICATE_BAR = (1 << 1), + }; + + int frobnicate(enum frobnicate_flags flags); + - Array names should be named in the singular form if the individual items are subject of use. E.g.: |
