August 23, 2004 real.alignof | ||||
---|---|---|---|---|
| ||||
The alignment size of the type "real" is smaller than it's size. real.sizeof: 10 real.alignof: 2 Maybe I don't get the point of ".alignof". Shouldn't it be at least ".sizeof"? system: Linux / i686 Thomas |
August 23, 2004 Re: real.alignof | ||||
---|---|---|---|---|
| ||||
Posted in reply to Thomas Kuehne | Thomas Kuehne wrote:
> The alignment size of the type "real" is smaller than it's size.
>
> real.sizeof: 10
> real.alignof: 2
>
> Maybe I don't get the point of ".alignof".
> Shouldn't it be at least ".sizeof"?
Thinking about 32bit machines for a moment...real requires 3 reads or writes, so long as it is aligned to a 2 byte boundary. Aligning it to a 4 byte boundary (or even more) doesn't gain you anything. You just don't want to hit an odd address, since then you might require 4 accesses.
On the other hand, you might be bad performance if a real crosses a cache line boundary...perhaps that is an argument for real.alignof=16 ?
|
Copyright © 1999-2021 by the D Language Foundation