[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] a question about alignment
From: |
jack W |
Subject: |
[lwip-users] a question about alignment |
Date: |
Fri, 5 Nov 2004 13:55:41 +0800 |
hi everyone
i have defined a non-alignment struct named ip_addr {.....}
and i use the macro IP4_ADDR() in the file ip_addr.h to write the ip address
"192.168.0.3" into a pointer variable my_addr. in the netif_add function ,
there is a macoro ip_add_set() . when the my_addr is put into the macro . the
result is (192.168.0.1)0x0100A8C0 not (192.168.0.3)0x0300A8C0 . I do not
know why ?
my struct is following : PACK_STRUCT_BEGIN
struct ip_addr{
PACK_STRUCT_FIELD(u32_t ip_addr);}
and i defined the macro PACK_STRUC_BEGIN __packed
and the macro PACK_STRUCT_FIEL __packed x;
i use the ADS (a METROWERKS CODEWARRIOR ARM DEVELOPMETN SUITE) in the winxp;
the __packed is the keyword of ads compiler that can define the non-alignment
struct.
there is a url of __packed information
http://www.arm.com/support/faqdev/1228.html