Hi, I had the following warning and now I found a simple workaround: On Thu, Jun 9, 2011 at 10:15 AM, Steffen Dettmer <steffen.dettmer@xxxxxxxxxxxxxx> wrote: > Hi, > > we implement some features either as functions or macros (if > small). One of the used compilers is gcc. With gcc-4.6.0 we get > new warnings. > > With macros, we for example have: > > #define fooGetFooPtr(bar) \ > (const uint8*)(((bar) != NULL ? (bar)->foo_ : (const uint8*)bar)) > > when used as: > > struct bar_s bar; > ptr *p = fooGetFooPtr(&bar); > > leading to: > > error: the comparison will always evaluate as 'true' for the > address of 'bar' will never be NULL [-Werror=address] casting the argument to "void*" before the check helps: #define fooGetFooPtr(bar) \ (const uint8*)((((void*)bar) != NULL ? (bar)->foo_ : (const uint8*)bar)) just in case someone searches through the mail archives :-)