title: One-liner for printing out the value of a macro from a header
body: <p>I have a header that defines a large number of macros, some of whom depend on other macros -- however, the dependencies are all resolved within this header.</p>
  
  <p>I need a one-liner for printing out the value of a macro defined in that header.</p>
  
  <p>As an example:</p>
  
  <pre><code>#define MACRO_A 0x60000000
  #define MACRO_B MACRO_A + 0x00010000
  //...
  </code></pre>
  
  <p>As a first blush:</p>
  
  <pre><code>echo MACRO_B | ${CPREPROCESSOR} --include /path/to/header
  </code></pre>
  
  <p>... which nearly gives me what I want:</p>
  
  <pre><code># A number of lines that are not important
  # ...
  0x60000000 + 0x00010000
  </code></pre>
  
  <p>... however, I'm trying to keep this from ballooning into a huge sequence of "pipe it to this, then pipe it to that ...".</p>
  
  <p>I've also tried this:</p>
  
  <pre><code>echo 'main(){ printf( "0x%X", MACRO_B ); }' \
    | ${CPREPROCESSOR} --include /path/to/header --include /usr/include/stdio.h
  </code></pre>
  
  <p>... but it (the gcc compiler) complains that -E is required when processing code on standard input, so I end up having to write out to a temporary file to compile/run this.</p>
  
  <p>Is there a better way?</p>
  
  <p>-Brian</p>