Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Between <code>int32</code> and <code>int32_t</code>, (and likewise between <code>int8</code> and <code>int8_t</code>) the difference is pretty simple: the C standard defines <code>int8_t</code> and <code>int32_t</code>, but does not define anything named <code>int8</code> or <code>int32</code> -- the latter (if they exist at all) is probably from some other header or library (most likely predates the addition of <code>int8_t</code> and <code>int32_t</code> in C99).</p> <p>Plain <code>int</code> is quite a bit different from the others. Where <code>int8_t</code> and <code>int32_t</code> each have a specified size, <code>int</code> can be any size >= 16 bits. At different times, both 16 bits and 32 bits have been reasonably common (and for a 64-bit implementation, it should probably be 64 bits).</p> <p>On the other hand, <code>int</code> is guaranteed to be present in every implementation of C, where <code>int8_t</code> and <code>int32_t</code> are not. It's probably open to question whether this matters to you though. If you use C on small embedded systems and/or older compilers, it may be a problem. If you use it primarily with a modern compiler on desktop/server machines, it probably won't be.</p> <p>Oops -- missed the part about <code>char</code>. You'd use <code>int8_t</code> instead of char if (and only if) you want an integer type guaranteed to be exactly 8 bits in size. If you want to store characters, you probably want to use <code>char</code> instead. Its size can vary (in terms of number of bits) but it's guaranteed to be exactly one byte. One slight oddity though: there's no guarantee about whether a plain <code>char</code> is signed or unsigned (and many compilers can make it either one, depending on a compile-time flag). If you need to ensure its being either signed or unsigned, you need to specify that explicitly.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload