[lkml]   [2000]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] 2.3.41 - cleanup file_operations structs
James Manning <> writes:
> [ Sunday, January 30, 2000 ] Ingo Oeser wrote:
> > This feature is not ANSI-C, so it is gcc specific.
> Yup, and since the kernel is gcc-specific anyway, we might as well
> get some benefit from it :)

In cases where standard C does not suffice, I would agree. But C99
also has designated initializers, with a different syntax from gcc:

gcc-style: struct my_struct foo = { my_member: 42 };
C99-style: struct my_struct foo = { .my_member = 42 };

C99 is only a de jure standard at the moment, but this is a feature of
C99 that will be adopted fairly quickly by other compiler vendors
(since it is relatively easy to implement). I suspect that eventually
gcc will recommend the use of C99-style initializers, with gcc-style
initializers being deprecated (egcs has supported the C99 syntax for a
while). Adopting gcc-style initializers might seem reasonable now, but
it could be a pain in five years time when most C programmers are more
familar with the C99 syntax.

So could you use a macro instead, such as:

#define STRUCT_ELEM_INIT(m) m :

This would avoid the dependency on a gcc-specific feature, and would
allow automatic conversion to the C99 syntax when that becomes widely

David Wragg

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:56    [W:0.098 / U:0.332 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site