Skip to content

Commit 2bed496

Browse files
deploy: fd5ba79
1 parent 00564c7 commit 2bed496

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

best-practices/dos-donts/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
zero and can round-trip (deserialize, serialize) an unknown enum value.</p><p><a id=dont-use-cc-macro-constants-for-enum-values></a></p><h2 id=macro-constants><strong>Don&rsquo;t</strong> Use C/C++ Macro Constants for Enum Values</h2><p>Using words that have already been defined by the C++ language - specifically,
5555
in its headers such as <code>math.h</code>, may cause compilation errors if the <code>#include</code>
5656
statement for one of those headers appears before the one for <code>.proto.h</code>. Avoid
57-
using macro constants such as &ldquo;<code>NULL</code>,&rdquo; &ldquo;<code>NAN</code>,&rdquo; and &ldquo;<code>DOMAIN</code>&rdquo; as enum values.</p><a id=dont-use-any><h2 id=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 &ldquo;<code>NULL</code>,&rdquo; &ldquo;<code>NAN</code>,&rdquo; and &ldquo;<code>DOMAIN</code>&rdquo; as enum values.</p><p><a id=dont-use-any></a></p><h2 id=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
5858
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
5959
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
6060
horizontal infrastructure needs to propagate completely arbitrary messages, and

0 commit comments

Comments
 (0)