[MPlayer-dev-eng] [PATCH] Fix "initialization discards qualifiers" warnings in cfg-*.h

Reimar Döffinger Reimar.Doeffinger at gmx.de
Thu Sep 9 23:56:48 CEST 2010


On Thu, Sep 09, 2010 at 11:38:22PM +0200, ubitux wrote:
> On Thu, Sep 09, 2010 at 10:34:39PM +0200, Reimar Döffinger wrote:
> > On Thu, Sep 09, 2010 at 01:49:46PM +0200, ubitux wrote:
> > > On Thu, Sep 09, 2010 at 07:19:49AM +0200, Reimar Döffinger wrote:
> > > > On Wed, Sep 08, 2010 at 11:01:06PM +0200, ubitux wrote:
> > > > > The void *p pointer initialization in the m_option array have mixed
> > > > > initialization (sometimes with the '&' unary operator, sometimes not). The
> > > > > patch also makes this consistent.
> > > > 
> > > > It's not inconsistent, we don't use & to get the address of an array type,
> > > > only for the other types.
> > > 
> > > Oh well ok… may I ask why?
> > 
> > Less unnecessary clutter. So mostly no real reason beyond personal taste.
> > Anyway, if readability is a concern, some alignment pretty-printing would
> > probably help far more than this minor detail.
> 
> Well in fact I didn't realized what exactly the problem was. As I
> understand it now, this is happening:
> 
>    const int a[10];     void *p = a     // MPlayer case, warning
>    int a[10];           void *p = a     // no warning
>    const int a[10];     void *p = &a    // no warning

If that's the case that AFAICT is a compiler bug.

> Since the void *p has to accept const and non-const values (in MPlayer
> design), their is no way to change it.

There is no reason you would _have_ to use the same void *.
You could have another (const) pointer in the struct just for the
suboptions.
I don't know how many other changes that might need though.


More information about the MPlayer-dev-eng mailing list