[EMAIL PROTECTED] wrote on Tue, 30 May 2006 09:28 -0400:
> Which is more common in compilers:
> 
> static struct foo foobar = {
>       field1: value1,
>       field4: value4
>       };
> 
> OR what's shown below:
> 
> static struct foo foobar = {
>       .field1 = value1,
>       .field4 = value4
>       };
> 
> The first is used by the kernel code, and  has been around for quite a 
> while.  I'm not sure what the second form gives us that the first one 
> doesn't.  Unless there is a good reason otherwise we should probably 
> stick with the most widely supported.

The first is a gcc-only extension, obsolete since gcc 2.5 according
to their manual.  The latter is part of the ISO C99 spec.  If we
were going to convert from the unnamed version to anything, I'd have
a strong preference for going with the spec.

> Murali Vilayannur wrote:
> >Oops that was my bad..I did not realize that this syntax is not supported
> >by many compilers! I was once bitten by initializing a struct
> >incorrectly, and I committed that change since I assumed that a user would
> >not be able to compile the kmod without having a compiler that understands
> >that syntax.

The kernel code is inherently tied to gcc, so designated
initializers causes no problem.  But the few places in dist-*.c that
went in last month might affect non-linux non-gcc clients or servers.
Looking back at old gcc versions, even ancient 2.5 supported this
feature.  Scanning web pages for sun and ibm show that they have had
support for some time too.

I think our only problem would be with an old vendor-supplied
compiler.  And my feel is that we should not bother supporting such
if it reduces our code quality.  For the next release, let's leave
in the few places (dist-*.c, and soon statecomp) where these are
used and see if anybody complains.  It will be easy enough to back
it out.  Other opinions?

                -- Pete
_______________________________________________
Pvfs2-developers mailing list
[email protected]
http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers

Reply via email to