0xFFFFFFFFul as (signed) long: UB, Impl-defined or just OK?
<p>Will this code print -1 on all sane (e.g. 2-s complement arithmetic) 32-bit machines, -1 on LLP64 (i.e. 64-bit Windows, where long is 32-bit) and 4 gig on all 64-bit Unix OS:es (i.e. on LP64 OS:es):</p>

<pre><code>#include &lt;iostream&gt;

using std::cout;

int main()
{
    long li = 0xfffffffful;

    cout &lt;&lt; "size of li: " &lt;&lt; sizeof(li) &lt;&lt; ", li: " &lt;&lt; li &lt;&lt; '\n';
}
</code></pre>

<p>Normally I use well-defined size for relevant variables, and std::numeric_limits instead of 'ul' numeric constants. So I would write something like</p>

<pre><code>const uint32_t MAX_INTERVAL = std::numeric_limits&lt;uint32_t&gt;::max(); 
const int64_t some_var = MAX_INTERVAL;
</code></pre>