[Top] [All Lists]

[PATCH] Minor style correction in util_sock

Subject: [PATCH] Minor style correction in util_sock
From: "Zachary Loafman"
Date: Mon, 7 Jul 2008 19:37:07 -0700
> On Fri, Jul 04, 2008 at 01:31:34AM -0700, Zachary Loafman wrote:
> > That said, I still would've coded it as sa->sin_family = AF_INET.
> > Flip-flopping types is fugly. :)
> Agreed. Feel free to submit a patch :-)

Attached. Now about those 4 I sent last week.. :)

> On the whole issue, if I get
> right, going via a char * or a void * avoids the whole
> aliasing issue?

That article seems to have a good summary, yeah. Going through char *
fixes it, but honestly, I prefer the approach of breaking out the
aliased types into small (theoretically inline-able) functions. The
in_addr_to_sockaddr_storage function is actually a great example of how
to avoid aliasing issues - it handles the messy aliasing of the
sockaddr_storage struct so that the caller doesn't get bitten. Many
times you can write little wrappers like that.


<Prev in Thread] Current Thread [Next in Thread>