On 3 Apr 2013, at 17:34, Greg Ercolano wrote:

> On 04/03/13 08:44, marty moore wrote:
>> I notice that old examples used
>> int i = (int)v;
>> but that won't work with gcc-4.4.5
>       Right -- probably a "precision loss" error during the void* -> int,
>       since sizeof(void*)==8 and sizeof(int)==4.
>       I think the best approach (in 1.3.x) is to use the new fl_intptr_t, e.g.
>           int i = fl_intptr_t(v);
>       Or, you could just use a long instead of an int, but that might cause
>       trouble on non-64bit builds.. which is I think what fl_intptr_t tries
>       to solve. (See the definition in FL/Fl_Widget.H)

Ah: right... Yes, I probably have -fpermissive set in my build environment 
anyway, so don't see this...

I think something based around intptr_t (or fl_intptr_t) is the way to go, 
since on any host system, regardless of word size, that is "guaranteed" to 
provide an integral type that is large enough to hold a pointer...

Probably intptr_t would work just about everywhere nowadays I'd guess, since 
C99 (and is it in C++11 too?) is pretty widely supported now.

But the definition for fl_intptr_t should work *everywhere* so it is probably 
the most portable option.

fltk mailing list

Reply via email to