dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Re: usb.c warning

Re: usb.c warning

From: Frank Gevaerts <>
Date: Wed, 4 Jan 2012 17:09:41 +0100

On Wed, Jan 04, 2012 at 05:00:09PM +0100, Magnus Holmgren wrote:
> Hi,
> Noticed a warning for this code in firmware/usb.c, line 557 (as of r31578):
> 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?

Almost certainly not. This looks like a bug waiting to happen to me.


"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan
Received on 2012-01-04

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy