Skip to content

Commit e7401a2

Browse files
Add note that enum values should be assigned densely and that negative numbers should be avoided.
PiperOrigin-RevId: 877367748
1 parent 19b5a5f commit e7401a2

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

content/programming-guides/style.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ and should be distinct from any of the semantic values you expect to be
150150
explicitly set. For more information on the unspecified enum value, see
151151
[the Proto Best Practices page](/best-practices/dos-donts#unspecified-enum).
152152

153+
Assign the number used for each value densely and sequentially increasing. Gaps
154+
in numbering should only occur when a previously used enum value is removed.
155+
Avoid using negative values.
156+
153157
#### Enum Value Prefixing {#enum-value-prefixing}
154158

155159
Enum values are semantically considered to not be scoped by their containing

0 commit comments

Comments
 (0)