[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [patch #5846] struct sockaddr_in has different alignment th
From: |
Jonathan Larmour |
Subject: |
[lwip-devel] [patch #5846] struct sockaddr_in has different alignment than struct sockaddr |
Date: |
Sat, 07 Apr 2007 20:20:10 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.13) Gecko/20060513 Fedora/1.0.8-1.1.fc3.1.legacy Firefox/1.0.8 |
Follow-up Comment #7, patch #5846 (project lwip):
The reason I was concerned about unnecessary overhead (extra code and/or
extra footprint) was because you had said earlier in the comment to which I
replied: "In other words, I think if the one is packed, the other should be
packed, also."
I was also extrapolating a bit - in your patch you, for example, align the
struct sockaddr to 64-bits for MEM_ALIGNMENT==8, but MEM_ALIGNMENT has
nothing to do with the alignment requirements of a struct in_addr which might
only need alignment to 1, 2, or 4 bytes. So to guarantee they'd match to avoid
any warning when the cast is made, since it happens *both* ways, you'd also
need to add some alignment component to struct sockaddr_in. With that patch's
approach anyway. The patch as it stands isn't right.
Anyway, the warning is irrelevant - as you say yourself, a struct sockaddr is
never deferenced in itself. There is not, and will not be, any problem here -
people don't create struct sockaddrs.
Although if/when someone finishes off ipv6, there'll be an AF_INET6 class to
distinguish and a struct sockaddr_in6 will probably have different alignment
constraints to a struct sockaddr_in.
Other stacks don't bother with this anyway: warnings, especially those
generated by obscure warning flags, are guides, not problems to be fixed. If
others think this really is a "problem", then the solution will have to
involve unions.
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/patch/?5846>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
- [lwip-devel] [patch #5846] struct sockaddr_in has different alignment than struct sockaddr, Simon Goldschmidt, 2007/04/02
- [lwip-devel] [patch #5846] struct sockaddr_in has different alignment than struct sockaddr, Kieran Mansley, 2007/04/03
- [lwip-devel] [patch #5846] struct sockaddr_in has different alignment than struct sockaddr, Simon Goldschmidt, 2007/04/03
- [lwip-devel] [patch #5846] struct sockaddr_in has different alignment than struct sockaddr, Jonathan Larmour, 2007/04/05
- [lwip-devel] [patch #5846] struct sockaddr_in has different alignment than struct sockaddr, Simon Goldschmidt, 2007/04/06
- [lwip-devel] [patch #5846] struct sockaddr_in has different alignment than struct sockaddr, Jonathan Larmour, 2007/04/06
- [lwip-devel] [patch #5846] struct sockaddr_in has different alignment than struct sockaddr, Simon Goldschmidt, 2007/04/07
- [lwip-devel] [patch #5846] struct sockaddr_in has different alignment than struct sockaddr,
Jonathan Larmour <=
- [lwip-devel] [patch #5846] struct sockaddr_in has different alignment than struct sockaddr, Simon Goldschmidt, 2007/04/11