title: Can you cast the result of sizeof
body: <p>I was wondering if it makes sense to cast the result of sizeof?<br>
  Example:</p>
  
  <p>Change <code>sizeof(example)</code> to <code>(size_t) sizeof(example)</code></p>
  
  <p>The return type is <code>std::size_t</code>but I get the error "Invalid arguements" in many functions (malloc, memset, ...) and after the cast it works. A quick check with <code>printf</code> showed me, that the results stayed the same.</p>
  
  <p>-edited- <br>
  As requested a short example function:<br></p>
  
  <pre><code>   __cxa_dependent_exception* __cxxabiv1:: __cxa_allocate_dependent_exception()  throw()
      {
          __cxa_dependent_exception *ps_ret;
  
          ps_ret = static_cast&lt;__cxa_dependent_exception *&gt; (o_exception_pool.allocate (
                  (size_t) sizeof(__cxa_dependent_exception )));
  
          if (!ps_ret)
          {
              std::terminate ();
          }
  
          memset (ps_ret, 0, (size_t) sizeof(__cxa_dependent_exception ));
  
          return ps_ret;
      }
  </code></pre>
  
  <p>Without the casts this code throws the mentioned error. The full example can be found in the gcc 4.5.4 source code "libstdc++-v3/libsupc++/eh_alloc.cc" <br>
  I am using MinGW.</p>