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

ubitux ubitux at gmail.com
Thu Sep 9 23:48:37 CEST 2010


On Thu, Sep 09, 2010 at 11:38:21PM +0200, ubitux wrote:
> 
> 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
> 
> Since the void *p has to accept const and non-const values (in MPlayer
> design), their is no way to change it. But then, to be logical, should we
> remove the constness by casting "a" in void* or just to it implicitly do
> that using the '&'?
> 
> It's surely a minor detail, but I think having all those warnings may hide
> something important…
> 
> Do you know what's the behaviour with other compilers? Does the specs say
> something about it?
> 

Reply to myself:

With clang I got the warning, even with void *p = &a. So the only viable
method would be to cast in void*. But that won't be nice at all for
readability.

-- 
ubitux


More information about the MPlayer-dev-eng mailing list