Rockbox mail archiveSubject: Re: usb.c warning
Re: usb.c warning
From: Michael Sevakis <jethead71_at_comcast.net>
Date: Wed, 4 Jan 2012 11:11:05 -0500
>> Noticed a warning for this code in firmware/usb.c, line 557 (as of
>> status = (status == USB_INSERTED) ? : USB_EXTRACTED;
>> According to the gcc manual (section 5.7), the expression "x ? : y" (a
>> gcc extension) has the value x if x is nonzero, otherwise z. So, status
>> is set to "true" or "USB_EXTRACTED". In this case, true happens to have
>> the same value as USB_INSERTED... Is that what was intended here?
> Yes. It's just like "status = (status == USB_INSERTED) ? status :
Oops. Stupid top post.
Anyway, I guess it could just be:
if (status != USB_INSERTED)
status = USB_EXTRACED;
At least that's more familiar.
Received on 2012-01-04