Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Yes most compilers do push on stack, or copy to stack value-passed structures (and <code>class</code>es) . It is generally required by the <a href="http://en.wikipedia.org/wiki/Application_binary_interface" rel="nofollow">ABI</a> (application binary interface) specification relative to the compiler &amp; processor &amp; operating system.</p> <p>See e.g. <a href="http://en.wikipedia.org/wiki/X86_calling_conventions" rel="nofollow">X86 calling conventions</a> &amp; <a href="http://www.yumpu.com/en/document/view/5100681/system-v-application-binary-interface-x86-64-linux" rel="nofollow">System V ABI x86-64</a> for details (at least for Linux, x86-64).</p> <p>Practically speaking, large structures are on the stack, passing (silently) a pointer to them thru registers.</p> <p><sup>The ABI defines if these structures are in the caller or callee call frame...</sup></p> <p>For two-word sized <code>struct</code>-s the Linux x86-64 ABI often passes them (both as argument &amp; as result) thru a pair of registers.</p> <p>With <a href="http://gcc.gnu.org/" rel="nofollow">GCC</a>, try compiling using <code>gcc -O -S -fverbose-asm foo.c</code> to get the assembly code <code>foo.s</code>; you could use also <a href="http://gcc-melt.org/#probe_id" rel="nofollow">GCC MELT probe</a> or <code>gcc -fdump-tree-all</code> to understand the internal (Gimple) representations.</p> <p>Notice that some quite complex <code>class</code> in C++ may have a small value size, because internally a lot of pointers are involved. For instance, on Linux/AMD64 <code>sizeof(std::string)</code> is just one (8 byte) word (containing a pointer to some complex stuff), which is probably passed by register. Likewise many containers of the C++ standard library have a small value size (most of the real data being indirectly accessed thru pointers). Details are obviously implementation specific.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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