title: C++/C int32_t and printf format: %d or %ld?
body: <p>In some platform, <code>int32_t</code> (from stdint.h) is <code>long int</code>, but in other platform, it could be <code>int</code>.  When I want to use <code>printf</code>, how can I determine which format, <code>"%ld"</code> or <code>"%d"</code>, should be used?</p>
  
  <p>Or, perhaps, I should force converting it to long like below:</p>
  
  <pre><code>int32_t m;
  m = 3;
  printf ("%ld\n", (long)m);
  </code></pre>
  
  <p>But that solution is tedious.  Any suggestions?</p>