libcdio-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libcdio-devel] Gentoo's warning message "may compile * fine but exh


From: Rocky Bernstein
Subject: Re: [Libcdio-devel] Gentoo's warning message "may compile * fine but exhibit random runtime failures"
Date: Thu, 2 Jun 2011 13:24:28 -0400

2011/6/2 Toralf Förster <address@hidden>

> I get during emerge of dev-libs/libcdio-0.82 :
>
>  * cdda-player.c:878: warning: the address of ‘artist’ will always evaluate
> as ‘true’
>  * cdda-player.c:879: warning: the address of ‘title’ will always evaluate
> as ‘true’
>  * cdda-player.c:880: warning: the address of ‘genre’ will always evaluate
> as ‘true’
>  * cdda-player.c:881: warning: the address of ‘year’ will always evaluate
> as ‘true’
>

I wouldn't call this a "warning" so much as some sort of informative
message. Consider the following code which distills what's going on:

#define foo(field) if (field) x++;

int main(int argc, char **argv)
{
    char field1[10];
    char *field2 = (void *) 0;
    int x=0;
    foo(&field1);
    foo(field2);
    return 0;
}


A C compiler can determine that in the first call of foo, the test
is unnecessary. However it is needed in the second test.

I think in this particular piece of code I could remove the test because all
fields passed here are not dynamically allocated. (I'm not totally sure
though and not sure they never will be.) So I'd rather not drop the test.

Of course, I welcome other thoughts and ideas on the matter.


>
>
> Is this already reported ?
> (I didn't found it in the mailing list archive threads).
>
> --
> MfG/Sincerely
> Toralf Förster
> pgp finger print: 7B1A 07F4 EC82 0F90 D4C2 8936 872A E508 7DB6 9DA3
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]