<p>For example, never define a macro like this:</p>

<pre><code>#define DANGER 60 + 2
</code></pre>

<p>This can potentially be dangerous when we do an operation like this:</p>

<pre><code>int wrong_value = DANGER * 2; // Expecting 124
</code></pre>

<p>Instead, define like this because you don't know how the user of the macro may use it:</p>

<pre><code>#define HARMLESS (60 + 2)
</code></pre>

<p>The example is trivial, but that pretty much explains my question. Are there any set of guidelines or best practices that you would recommend when writing a macro?</p>

<p>Thanks for your time!</p>

In the expansion, put parenthesis around the arguments, so that if they pass in a expression you will get the intended behavior.
```
```
#define LESS_THAN(X,Y) (((X) < (Y) ? (X) : (Y))
```
```