On Sun, Oct 04, 2015 at 04:28:35PM +0000, David Holland wrote: > On Sun, Oct 04, 2015 at 11:52:18AM +1100, matthew green wrote: > > how about this: > > I would suggest using void * for the unaligned pointer, but other than > that looks at least correctly consistent with the discussion here.
Agree - or char *. It might not matter for this code, and for x86, but in general you don't want gcc to see misaligned pointers. It is also worth noting that you only need to add 8 (for amd64) to the size, and that the pointer can only need 8 adding. OTOH having an allocator not return aligned memory is stupid. Adding a 16 or 32 byte header to allocation requests that are not powers of 2 probably makes little difference to the footprint. If code allocates 4k you don't really want a header at all. David -- David Laight: da...@l8s.co.uk