[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [lwip-users] Struct packing/alignment problems
From: |
Mountifield, Tony |
Subject: |
RE: [lwip-users] Struct packing/alignment problems |
Date: |
Wed, 5 May 2004 16:33:15 +0100 |
Hi All
I don't have a strong opinion one way or the other about removing the packing
macros, but I wanted to reply to one point:
> The macros will have to remain in the code for the Ethernet
> ARP header, if I understand that correctly, so it really
> isn't worth worrying about.
This is no longer correct. Since the sipaddr and dipaddr fields were changed
from struct ip_addr to struct ip_addr2, they now only have 16-bit alignment
requirements (this is why they were changed) ...
... so long as compilers don't try to insert padding before and after struct A
in struct B in the following example:
struct A {
u16_t x[2];
};
struct B {
u16_t p;
struct A q;
u16_t r;
};
Hopefully:
offsetof(p) is 0
offsetof(q.x[0]) is 2
offsetof(q.x[1]) is 4
offsetof(r) is 6
sizeof(struct B) is 8
Cheers,
Tony
***********************************************************************************
This email, its content and any attachments is PRIVATE AND
CONFIDENTIAL to TANDBERG Television. If received in error please
notify the sender and destroy the original message and attachments.
www.tandbergtv.com
***********************************************************************************
- Re: [lwip-users] Struct packing/alignment problems, (continued)
- Re: [lwip-users] Struct packing/alignment problems, Leon Woestenberg, 2004/05/05
- Re: [lwip-users] Struct packing/alignment problems, Timmy Brolin, 2004/05/05
- Re: [lwip-users] Struct packing/alignment problems, K.J. Mansley, 2004/05/05
- Re: [lwip-users] Struct packing/alignment problems, Leon Woestenberg, 2004/05/05
- Re: [lwip-users] Struct packing/alignment problems, Timmy Brolin, 2004/05/05
- Re: [lwip-users] Struct packing/alignment problems, Leon Woestenberg, 2004/05/05
- Re: [lwip-users] Struct packing/alignment problems, K.J. Mansley, 2004/05/04
- Re: [lwip-users] Struct packing/alignment problems, Timmy Brolin, 2004/05/04
RE: [lwip-users] Struct packing/alignment problems, Mountifield, Tony, 2004/05/04
RE: [lwip-users] Struct packing/alignment problems,
Mountifield, Tony <=
RE: [lwip-users] Struct packing/alignment problems, K.J. Mansley, 2004/05/05
RE: [lwip-users] Struct packing/alignment problems, Mountifield, Tony, 2004/05/06