Reputation: 97
Technically, the size of a structure is the amount of bytes that need the variables of the structure.
For example, if I use the next standard structure:
; building the sockaddr_in struct
push 0 ; INADDR_ANY
push WORD 0x672b ; port 11111
push WORD 2 ; AF_INET
2 tutorials I'm reading say: sizeof(struct sockaddr) = 16 (socklen_t)
But I only see 1 dword and 2 words = 8 bytes. 8 bytes, no 16. What am I doing bad? The tutorials don't use macros, they put the imm value and no more.
Upvotes: 0
Views: 93
Reputation: 359
See this:
sockaddr_in STRUCT
sin_family DW ?
sin_port DW ?
sin_addr DB ?
DB ?
DB ?
DB ?
sin_zero DB 8 DUP (?)
sockaddr_in ENDS
Upvotes: 0