Re: sparse segfaults

From: Nikita Danilov
Date: Sun Nov 21 2004 - 17:31:17 EST


linux-os <linux-os@xxxxxxxxxxxxxxxxxx> writes:

> On Sat, 20 Nov 2004, Russell King wrote:
>

[...]

>>
>> int tickadj = 500/HZ ? : 1; /* microsecs */
>>
>> which makes it look like sparse doesn't understand such constructions.
>
> I don't think any 'C' compiler should understand such constructions
> either.
> There is no result for the TRUE condition, and the standard
> does not provide for a default. The compiler should have written
> a diagnostic.

This is GCC extension.

foo ? : bar

is equivalent to

foo ? foo : bar

except that foo is evaluated only once.

Nikita.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/