lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #33485] SOCK_ADDR_TYPE_MATCH and SOCK_ADDR_TYPE_MATCH_


From: Kieran Mansley
Subject: [lwip-devel] [bug #33485] SOCK_ADDR_TYPE_MATCH and SOCK_ADDR_TYPE_MATCH_OR_UNSPEC use error
Date: Tue, 07 Jun 2011 14:17:51 +0000
User-agent: Opera/9.80 (X11; Linux i686; U; en) Presto/2.7.62 Version/11.00

Follow-up Comment #7, bug #33485 (project lwip):

> From the draft C99 standard (6.7.2.1), you'll note the compiler 
> can add any padding is chooses between members. So the 
> alignment1 and alignment2 are also second guessing the compiler, > aren't
they?

Yes, they are, which is why I think if getting particular alignment of fields
in a structure is important, padding is not the way to do it: "If we really
need to avoid padding between fields in a structure then we must mark it as
packed or specify the alignment of fields using compiler-specific directives"

alignment1 and alignment2 will give the required result on most compilers, and
so as they are more portable than the compiler-specific directives there is an
argument in favour of doing it that way, as long as we have suitable
assertions in place to highlight when this assumption about the compiler
behavior is broken.

I can't see a case for adding more padding however because it would neither
increase our portability nor produce the correct result more often, and would
just bloat the size of the structures on most compilers.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?33485>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]