title: How to print types of unknown size like ino_t?
body: <p>I often experience situations where I want to print with <code>printf</code> the value of an integer type of implementation-defined size (like <code>ino_t</code> or <code>time_t</code>). Right now, I use a pattern like this for this:</p>
  
  <pre><code>#include &lt;inttypes.h&gt;
  
  ino_t ino; /* variable of unknown size */
  printf("%" PRIuMAX, (uintmax_t)ino);
  </code></pre>
  
  <p>This approach works so far but it has a couple of disadvantages:</p>
  
  <ul>
  <li>I have to know whether the type I'm trying print is signed or unsigned.</li>
  <li>I have to use a type cast that possibly enlarges my code.</li>
  </ul>
  
  <p>Is there a better strategy?</p>