[Rd] Why does an empty vector occupy 40 bytes?

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Aug 29 22:17:07 CEST 2013

On 29/08/2013 20:26, Hadley Wickham wrote:
>>> Do pointers always have to be aligned?
>> Depends on the architecture, e.g., Sparc doesn't allow non-aligned pointers at all (results in a segfault), SV x86_64 ABI specifies pointers to be aligned at 8 bytes, but the x86_64 CPUs will allow misaligned pointers with a performance penalty (the same was true for x86 - i.e. misaligned pointers are tolerated with a penalty).
> Ok, so you might not have to align pointers a particular architecture,
> but if you're writing code that you want to work across multiple
> architectures you must.

Yes, and note too that you may or may not need to align doubles, 
independently of pointers (and it may even be a compiler setting: it is 
on Solaris).

> Hadley

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-devel mailing list