Hi, On Tue, 23 Feb 2010, Richard Guenther wrote:
On Tue, 23 Feb 2010, Jan Beulich wrote:
Richard Guenther
23.02.10 15:35 >>> So that's a more convincing example to at least get consistency here. I'll open a bug, but please fix the kernel to use offsetof. Yeah, I meanwhile got confirmation that this is going to be accepted upstream.
Hm, but it is all fine according to 6.6 and 6.7.5.2 - the fine reading differencing between integer constant expression and constant initializer.
Array sizes must be integer constant expression for the type to not be
variably modified. All evaluated casts in integer constant expressions
must convert arithmetic types to integer types. Pointer types are no
arithmetic types. That's the catch which renders the whole thing invalid.
Additionally (to Jan) 6.6/10 gives leeway only to accept other forms of
constant expressions. Integer constant expressions are completely
specified and are the ones that must be used in array lengths to make it
not variably modified.
Regarding the wish to not have to use stddef.h: that's premature. Even a
freestanding conforming implementation (which means one that doesn't
provide a full C library, exactly something that the kernel wants) is
required to provide the