You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: best-practices/dos-donts/index.html
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@
54
54
zero and can round-trip (deserialize, serialize) an unknown enum value.</p><p><aid=dont-use-cc-macro-constants-for-enum-values></a></p><h2id=macro-constants><strong>Don’t</strong> Use C/C++ Macro Constants for Enum Values</h2><p>Using words that have already been defined by the C++ language - specifically,
55
55
in its headers such as <code>math.h</code>, may cause compilation errors if the <code>#include</code>
56
56
statement for one of those headers appears before the one for <code>.proto.h</code>. Avoid
57
-
using macro constants such as “<code>NULL</code>,” “<code>NAN</code>,” and “<code>DOMAIN</code>” as enum values.</p><aid=dont-use-any><h2id=avoid-any><strong>Do</strong> prefer extensions over <code>Any</code> where possible</h2><p>If you plan to use <code>Any</code>, first double-check if extensions can satisfy the use
57
+
using macro constants such as “<code>NULL</code>,” “<code>NAN</code>,” and “<code>DOMAIN</code>” as enum values.</p><p><aid=dont-use-any></a></p><h2id=avoid-any><strong>Do</strong> prefer extensions over <code>Any</code> where possible</h2><p>If you plan to use <code>Any</code>, first double-check if extensions can satisfy the use
58
58
case instead. If yes, prefer using extensions.</p><p><code>Any</code> was created in Proto3 to replace extensions. However, it has a number of
59
59
design flaws. For most use cases, prefer using extensions.</p><p>The main use case that <code>Any</code> fulfills is the uncommon scenario in which
60
60
horizontal infrastructure needs to propagate completely arbitrary messages, and
0 commit comments