title: Forcing preprocessor error with macro
body: <p>Is there a way that I can force a preprocessor macro in C++ to emit an error? What I would like to do is define a macro <code>UNKNOWN</code>. I'm writing some code for a robot, and I don't yet know where all of the electronics are being plugged in. I'd like to be able to define the ports in some header file, like</p>
  
  <pre><code>const int MOTOR_PORT = 1;
  const int FAN_PORT = 2;
  //etc.
  </code></pre>
  
  <p>However, when I reach a port that I don't yet know, I want to be able to write something like</p>
  
  <pre><code>const int LED_PORT = UNKNOWN;
  </code></pre>
  
  <p>In debug mode, <code>UNKNOWN</code> would just be defined to some arbitrary value, like 0. However, when compiling in release mode, I want it to throw an error when <code>UNKNOWN</code> is used, so that unassigned ports don't end up in the final release. I know I can use the <code>#error</code> directive to force an error, but can I do something similar in a macro?</p>
  
  <p>I've seen a solution using <code>static_assert</code>, but I unfortunately can't use C++11 for this platform.</p>