Re: [PATCH] serial/atmel_serial: Fix another fallout of the change to BUILD_BUG_ON

From: Rusty Russell
Date: Mon Oct 19 2009 - 10:32:56 EST


On Mon, 19 Oct 2009 06:49:40 pm Jan Beulich wrote:
> >>> Rusty Russell <rusty@xxxxxxxxxxxxxxx> 19.10.09 08:08 >>>
> >How's this? It's not quite valid C, but it "works":
>
> But that's not what you proposed initially, i.e. generating a link time
> error if a compile time error can't be generated (and only if even a link
> time error isn't possible, a run time one should be forced).

Yeah, this was cleverer. A compile time is nicer than link time. And this
is *actually* what I want: a compile fail if the compiler knows enough, runtime
otherwise.

> And btw., why do you think this isn't valid C?

>From my glance at ISO C, non-positive sized variable length arrays are
invalid. gcc here seems to give the expected results (eg. sizeof gives
a negative result).

Cheers,
Rusty.
--
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/