Fix "warning: cast from pointer to integer of different size"

Erik de Castro Lopo mle+win at mega-nerd.com
Wed Apr 23 17:34:43 CDT 2008


David Laight wrote:

> On Tue, Apr 22, 2008 at 11:50:05PM +0900, Dmitry Timoshkov wrote:
> > "Erik de Castro Lopo" <mle+win at mega-nerd.com> wrote:
> > 
> > > /* get pointer to object containing list element */
> > > #define LIST_ENTRY(elem, type, field) \
> > > -    ((type *)((char *)(elem) - (unsigned int)(&((type *)0)->field)))
> > > +    ((type *)((char *)(elem) - (unsigned long)(&((type *)0)->field)))
> 
> How about:
>     ((type *)((char *)(elem) - ((char *)(&((type *)0)->field) - (char *)0)))

Much, much better, thank you. I don't know why I didn't see it myself.

Cheers,
Erik
-- 
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"I saw `cout' being shifted "Hello world" times to the left
and stopped right there." -- Steve Gonedes



More information about the wine-devel mailing list