title: Avoiding predefined numeric constants conflicting with enumerations in C++
body: <p>This question is related to <a href="https://stackoverflow.com/q/3473406/229311">GCC says &quot;syntax error before numeric constant&quot; in generated header file from bison</a> and <a href="https://stackoverflow.com/q/6289376/229311">I&#39;m getting an error concerning enum (I think)</a>, but the answers there only gave the reason for why one might see the error, "error: syntax error before numeric constant." Unless I glossed over it, I didn't see any good solutions to avoid this problem (except of course to simply rename our enumeration constants). Thus, my question is: besides simply renaming enum constants to avoid this naming conflict, are there other (preferable) ways to get around this problem? Using namespaces does not seem to work.</p>
  
  <p>UPDATE (for namespaces):
  I get this error:</p>
  
  <pre><code>enum.cpp:5:5: error: expected identifier before numeric constant
  enum.cpp:5:5: error: expected ‘}’ before numeric constant
  enum.cpp:5:5: error: expected unqualified-id before numeric constant
  enum.cpp:7:1: error: expected declaration before ‘}’ token
  </code></pre>
  
  <p>from this program:</p>
  
  <pre><code>#include &lt;sys/ioctl.h&gt;
  
  namespace mine {
    enum test {
      NCC
    };
  }
  
  int main(int argc, char** argv)
  { 
    return 0;
  }
  </code></pre>
  
  <p>Note, I get the same error when compiling this program:</p>
  
  <pre><code>#define NCC 5
  
  namespace mine {
    enum test {
      NCC
    };
  }
  
  int main(int argc, char** argv)
  { 
    return 0;
  }
  </code></pre>