News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Wrong result of SIZEOF for a nested structure

Started by Yuri, March 13, 2015, 03:41:56 PM

Previous topic - Next topic

Yuri

The S1 structure shows different size depending on whether it's nested or not.

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

Busy spell with other work, just as I was nearing completion of GoAsm v0.60, but I shall look into this one...