On 3 Apr 2013, at 19:38, Richard Sanders wrote:

> When I first compiled with 64 bit linux the compiler complained about 
> 
> int i = (int)(v);
> 
> 
> but was happy with 
> 
> long i = (long)(v);


Greg's suggestion of using fl_intptr_t seems like the most portable option, 
should work *everywhere* I think!


> 
> Both Linux and mingw 32 bit are happy with the change to long from
> int.
> 
> Mingw64 is another fish. AFAIK pointers in win64 are 64 bit pointers
> and the compiler issues errors. The work around for that is to use the
> compiler switch "fpermissive", then only warnings are issued.


The *nix's (and VxWorks, others...) went from being ILP32, to being LP64, so in 
both those cases sizeof(long) == sizeof(ptr), but in the 64 bit cases 
sizeof(int) != sizeof(ptr).

However, in an attempt to preserve as much as possible of their API, MS decided 
to go from ILP32 to LLP64/IL32, so that in Win64 code sizeof(long) != 
sizeof(ptr), you need to use sizeof(long long) == sizeof(ptr)

Or... use intptr_t, since sizeof(intptr_t) == sizeof(ptr) everywhere...

And of course sizeof(fl_intptr_t) == sizeof(ptr) everywhere too!


> 
> Now in all cases long works so the same code covers all bets.

Still think fl_intptr_t is the more portable solution long term.

> Don't know about macs though.

A Mac is just a *nix box these days... 


_______________________________________________
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to