Author Topic: Wrong result of SIZEOF for a nested structure  (Read 3152 times)

Yuri

  • Member
  • **
  • Posts: 179
Wrong result of SIZEOF for a nested structure
« on: March 13, 2015, 03:41:56 PM »
The S1 structure shows different size depending on whether it's nested or not.
Code: [Select]
S1 STRUCT
    a DD
    b DD
ENDS

S2 STRUCT
    c S1
ENDS

CODE SECTION

Start:
    invoke msvcrt:printf, "sizeof S1 = %d  sizeof S2.c = %d", sizeof S1, sizeof S2.c
#if x86
    add esp,0Ch
#endif
    ret

Output:
Quote
sizeof S1 = 8  sizeof S2.c = 4

wjr

  • Member
  • **
  • Posts: 242
    • WJR's website
Re: Wrong result of SIZEOF for a nested structure
« Reply #1 on: April 03, 2015, 01:28:23 AM »
Busy spell with other work, just as I was nearing completion of GoAsm v0.60, but I shall look into this one...