On Mon, Oct 15, 2012 at 7:58 PM, Pete Batard <p...@akeo.ie> wrote:

> On 15 October 2012 12:15, Sean McBride <s...@rogue-research.com> wrote:
> >>3) Look at how other software that uses -Wcast-align handles the same
> issue.
> >
> > I'm not exactly sure what you're asking...
>
> I was suggesting that, before we do anything, we look at what projects
> that:
> 1. Chose to use -Wcast-align
> 2. Ran into the warning above
> chose to do to see if there is a trend and try to get some additional
> ideas.
>
> > I looked around a bit, and other projects seem to respond to
> -Wcast-align warnings with everything from disabling the warnings to fixing
> their code.
>
> Well, it's the "how" part of "fixing their code" I'm interested in.
> Projects that disable the warning are of no interest with regards to
> what we're trying to figure out.
>
> > Would you accept a patch with my solution #1, again:
> >
> >  1) making libusb_control_transfer_get_setup not inline, so it's iffy
> cast is hidden in a .c file
>
> I will accept whatever when I get a chance to look more closely into
> it, which is likely to be a while. However I'm not the only
> maintainer/contributor around, so if there's a consensus, I'm likely
> to rally to it. That is unless the proposal is for an anonymous union,
> which I will continue to vote against. To me an anonymous union is
> akin to saying "We can't/don't want to tell you how you should use our
> API".
>


In this particular case, the buffer pointer in a libusb_transfer structure
really can be one of two types: unsigned char * or struct
libusb_control_setup *.  A union would be appropriate, anonymous or not.
Anonymous merely allows existing code to compile without error.

There is also an argument for changing the buffer parameters to
libusb_fill_control_setup() and libusb_fill_control_transfer() to struct
libusb_control_setup *, but I'm just tossing that in for the record.

Orin.
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to