cast a C char array - offset ?

FG via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Feb 2 06:06:58 PST 2015


On 2015-02-02 at 14:40, irtcupc wrote:
> On Monday, 2 February 2015 at 13:34:28 UTC, ketmar wrote:
>>   struct _Disasm {
>>   align(1):
>>
>> the difference is that `align` before struct tells how structure should
>> be packed (i.e. when you have `_Disasm[2] arr`). and `align` *inside*
>> struct tells compiler how struct *members* should be packed.
>
> Thx, problem fixed, it works now.

Yeah, without the align(1) inside the struct, the members of the struct were not crammed, so VirtualAddr started in byte x+8 instead of x+4 (on a 32-bit machine), and that was the source of the extra 4-byte shift you encountered.


More information about the Digitalmars-d-learn mailing list