title: Opposite of C preprocessor "stringification"
body: <p>When using C preprocessor one can stringify macro argument like this:</p>
  
  <pre><code>#define TO_STRING(x) "a string with " #x
  </code></pre>
  
  <p>and so when used, the result is as follows:</p>
  
  <p><code>TO_STRING(test)</code> will expand to: <code>"a string with test"</code></p>
  
  <p>Is there any way to do the opposite? Get a string literal as an input argument and produce a C identifier? For example:</p>
  
  <p><code>TO_IDENTIFIER("some_identifier")</code> would expand to: <code>some_identifier</code></p>
  
  <p>Thank you for your answers.</p>
  
  <p>EDIT: For those wondering what do I need it for:</p>
  
  <p>I wanted to refer to nodes in a scene graph of my 3D engine by string identifiers but at the same time avoid comparing strings in tight loops. So I figured I'll write a simple tool that will run in pre-build step of compilation and search for predefined string - for example <code>ID("something")</code>. Then for every such token it would calculate CRC32 of the string between the parenthesis and generate a header file with #defines containing those numerical identifiers. For example for the string <code>"something"</code> it would be:</p>
  
  <p><code>#define __CRC32ID_something 0x09DA31FB</code></p>
  
  <p>Then, generated header file would be included by each cpp file using <code>ID(x)</code> macros. The <code>ID("something")</code> would of course expand to <code>__CRC32ID_something</code>, so in effect what the compiler would see are simple integer identifiers instead of human friendly strings. Of course now I'll simply settle for <code>ID(something)</code> but I thought that using quotes would make more sense - a programmer who doesn't know how the <code>ID</code> macro works can think that <code>something</code> without quotes is a C identifier when in reality such identifier doesn't exist at all.</p>