I am using eclipse with cygwin. The application has 64 bits. In cygwin, a structure is defined as:
struct addrinfo {
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
socklen_t ai_addrlen;
char *ai_canonname;
struct sockaddr *ai_addr;
struct addrinfo *ai_next;
};
The result of sizeof (addrinfo) is 48. The size of socketlen_t is 4 bytes. The size of the int type is 4 bytes. The pointer has 8 bytes in a 64-bit application. The total byte is 44 (4 ints = 16 bytes, socket_len = 4 bytes, 3 pointers = 24; 20 + 4 + 24 = 44). I wonder why 4 bytes are missing? Are they for filling? I thought 44 bytes did not need to be aligned. Any thought?
Thanks for the reply in advance.
source
share