Protobuf enums replicate some behaviors from C++ enums, leading to potential issues such as name collisions due to unscoped values. Buf lint rules like ENUM_VALUE_PREFIX and ENUM_ZERO_VALUE_SUFFIX help mitigate these problems. It’s recommended to use prefixes for enum values to avoid these pitfalls and to select a generic ‘unknown’ as the default zero value.

4m read timeFrom mcyoung.xyz
Post cover image
Table of contents
C++-Style EnumsZero ValuesWhy Don’t All of Google’s Protobuf Files Do This?

Sort: