Can bit-fields be used as a «poor man's» fast integer type?
<p>I've just noticed an interesting property of gcc with regard to bit-fields. If I create a <code>struct</code> like the following:</p>

<pre><code>template &lt;int N&gt;
struct C
{
    unsigned long long data : N;
};
</code></pre>

<p>Then on amd64:</p>

<ol>
<li>with <em>-m64</em>, for N ∊ &lt;1, 64>, <code>sizeof(C) == 8</code>;</li>
<li>with <em>-m32</em>, for N ∊ &lt;1, 32>, <code>sizeof(C) == 4</code> and for N ∊ &lt;33, 64>, <code>sizeof(C) == 8</code>.</li>
</ol>

<p>(with <code>sizeof(unsigned long long) == 8</code>).</p>

<p>That seems to <em>mostly</em> resemble the C99/C++11 <code>uint_fastXX_t</code> except for the fact that on my system <code>sizeof(uint_fast8_t) == 1</code>. But for example, I can't reproduce anything similar with <code>__int128</code> (which always results in <code>sizeof(C) == 16</code>).</p>

<p>Does it seem like a good idea to you to use the fore-mentioned <code>struct</code> as a «poor man's» replacement for <code>uint_fastXX_t</code> <em>in C++98</em>?</p>
