title: Cast int to pointer - why cast to long first? (as in p = (void*) 42; )
body: <p>In the <a href="https://en.wikipedia.org/wiki/GLib" rel="noreferrer">GLib</a> documentation, there is a chapter on type conversion macros.
  In the discussion on converting an <code>int</code> to a <code>void*</code> pointer it says (emphasis mine):</p>
  
  <blockquote>
    <p>Naively, you might try this, but it's incorrect:</p>
  
  <pre><code>gpointer p;
  int i;
  p = (void*) 42;
  i = (int) p;
  </code></pre>
    
    <p>Again, that example was not correct, don't copy it. <strong>The problem is
    that on some systems you need to do this:</strong></p>
  
  <pre><code>gpointer p;
  int i;
  p = (void*) (long) 42;
  i = (int) (long) p;
  </code></pre>
  </blockquote>
  
  <p>(source: GLib Reference Manual for GLib 2.39.92, chapter <a href="https://developer.gnome.org/glib/stable/glib-Type-Conversion-Macros.html" rel="noreferrer">Type Conversion Macros</a> ).</p>
  
  <p>Why is that cast to <code>long</code> necessary?</p>
  
  <p>Should any required widening of the <code>int</code> not happen automatically as part of the cast to a pointer?</p>