title: Why is the ternary operator used to define 1 and 0 in a macro?
body: <p>I'm using an SDK for an embedded project. In this source code I found some code which at least I found peculiar. In many places in the SDK there is source code in this format:</p>
  
  <pre><code>#define ATCI_IS_LOWER( alpha_char )  ( ( (alpha_char &gt;= ATCI_char_a) &amp;&amp; (alpha_char &lt;= ATCI_char_z) ) ? 1 : 0 )
  
  #define ATCI_IS_UPPER( alpha_char )  ( ( (alpha_char &gt;= ATCI_CHAR_A) &amp;&amp; (alpha_char &lt;= ATCI_CHAR_Z) ) ? 1 : 0 )
  </code></pre>
  
  <p>Does the use of the ternary operator here make any difference?</p>
  
  <p>Isn't</p>
  
  <pre><code>#define FOO (1 &gt; 0)
  </code></pre>
  
  <p>the same as</p>
  
  <pre><code>#define BAR ( (1 &gt; 0) ? 1 : 0)
  </code></pre>
  
  <p>?</p>
  
  <p>I tried evaluating it by using</p>
  
  <pre><code>printf("%d", FOO == BAR);
  </code></pre>
  
  <p>and get the result 1, so it seems that they are equal. Is there a reason to write the code like they did?</p>