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

Erik de Castro Lopo mle+win at mega-nerd.com
Tue Apr 22 23:34:56 CDT 2008


Dmitry Timoshkov wrote:

> "Erik de Castro Lopo" <mle+win at mega-nerd.com> wrote:
> 
> > FIELD_OFFSET is defined in include/winnt.h. 
> > 
> > Now I could include winnt.h into include/wine/list.h but that doesn't
> > seem right. I could also copy it,but having two definitions of the
> > same macro is also not right. I'm also sure that moving the definition
> > from include/winnt.h to include/wine/list.h will break existing code.
> > 
> > Any suggestions for dealing with this?
> 
> Replacing (unsigned int) cast by (unsigned long) doesn't guarantee
> anything, long can be a 32-bit entity on a 64-bit platform.

I'm perfectly happy to accept that, but the real question was,
"what is the best way to get FIELD_OFFSET in include/wine/list.h?".

I see four options:

 0) Include include/winnt.h into include/wine/list.h. Ugly!

 1) Copy definition of FIELD_OFFSET macro from include/winnt.h to
    include/wine/list.h. Ugly!

 2) Move the definition of FIELD_OFFSET macro from include/winnt.h to
    include/wine/list.h. This will probably break existing code. Ugly!

 3) Add a definition if FIELD_OFFSET wrapped in #ifndef. This is the
    least ugly option but would cause surprising results if one or
    the other was changed.

So, to rephrase the question, which of the above would actually be
accepted as a patch? If none of them are good enough (highly 
likely) can someone please suggest an alternative that would be
acceptable?

Cheers,
Erik
-- 
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
Journalist: Microsoft CEO Steve Ballmer has finally said Linux
            is the No. 1 threat to Windows. What's your response to that?
Linus     : "Tag, you're it." I don't care. They've had a lot of
            enemies in their time. Let them fight one enemy that
            doesn't care for a change.



More information about the wine-devel mailing list