[MPlayer-dev-eng] [PATCH] kill a few warnings (more completepatch)
Pierre Lombard
p_l at gmx.fr
Fri Sep 12 12:03:52 CEST 2003
Hi,
* Sycotic Smith <sycotic at linuxmail.org> [2003-09-11 16:43]:
> > Index: libao2/pl_resample.c
> > ===================================================================
> > -static pl_resample_t pl_resample = {NULL,NULL,1,1,1,0,W};
> > +static pl_resample_t pl_resample = {
> > + .data = NULL,
> > + .w = NULL,
> > + .dn = 1,
> > + .up = 1,
> > + .channels = 1,
> > + .len = 0,
> > + .ws = W, <this line! and many more followed...>
> > +};
>
> I'm no expert, but wouldn't the trailing ',' on all the last parms give yet another warning? They always seem to when I forget and put them in...
I guess it depends on your compiler version and which C standard it
implements. The trailing ',' should be ok in C99 (IIRC).
The attached code snippet should exhibit every possible warning for
those struct initializers.
So, if you get a warning, it means your cc is not C99 compliant. Anyway
you would have had one should the previous initialization style have
been kept.
(For instance in this very pl_resample.c, the last field .xs is not
initialized.)
Another small advantage I see to this trailing comma is that you can
easily add a new field by modifying 1 line instead of 2 (50% rebate ;)
--
Best regards,
Pierre Lombard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.c
Type: text/x-csrc
Size: 970 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20030912/deb94eb7/attachment.c>
More information about the MPlayer-dev-eng
mailing list