tcpdump mailing list archives
Re: about struct in_addr
From: Sebastien Raveau <sebastien.raveau () epita fr>
Date: Sun, 7 May 2006 03:42:18 +0200
On Saturday 06 May 2006 06:18, Lan Qing wrote:
the struct in_addr have only one variable in it, is there any necessary to define a struct like that? why not use "typedef in_addr_t in_addr;" directly?
POSIX (the standard for UNIX software) states that: "The <netinet/in.h> header shall define the in_addr structure that includes at least the following member: in_addr_t s_addr", as you can see for youself at: http://www.opengroup.org/onlinepubs/009695399/basedefs/netinet/in.h.html So it's a structure because it has to contain AT LEAST that one member :-) But as Hannes Gredler pointed out, the result will be exactly the same wether it's a typedef or a structure: the former will be transformed by the compiler into a reference to some memory address containing 4 bytes, and the latter into a reference to some memory address containing a structure with an offset of 0 to access its first 4 bytes... -- Sébastien Raveau computer and network security student head of the hawKeye network monitor project http://hawkeye.sourceforge.net/
Attachment:
_bin
Description:
Current thread:
- about struct in_addr Lan Qing (May 05)
- Re: about struct in_addr Hannes Gredler (May 06)
- Re: about struct in_addr Guy Harris (May 06)
- Re: about struct in_addr Sebastien Raveau (May 06)
- Re: about struct in_addr Lan Qing (May 08)