> [email protected] wrote:
> >> [..] On any other platform,
> >> sizeof(long) == sizeof(void*)
> >>
> >
> > When I worked on the AS/400, sizeof(void*) was 256. I don't recall
> > if longs were 4 or 8 bytes long.
>
> OK - fair point. I was only thinking of host platforms on which I know
> fltk works...
> I can not say whether AS/400 could fall into that camp, but I'm guessing
> not!
>
> > I have no idea if that factoid is relevant to the discussion
> > at hand, but to assume that sizeof(long) == sizeof(void*) is
> > surely incorrect. windows + *nix != everything :)
>
> Indeed so. My observation that sizeof(long) == sizeof(void*) was only
> really meant to note that the MS guys, for reasons best known to
> themselves decided to go with an LLP64 ABI whilst "everybody else"
> (where in this case "everybody" means OSX, linux, etc... Though not
> AS/400, or anything based on a SHARC architecture, or... well, anyway)
> decided to go LP64.
>
> I guess that MS have a ton of code that assumes sizeof(long) == sizeof(int).
>
> We (fltk) have a few places where we have kind of assumed that
> sizeof(long) == sizeof(void*), but only in so far as we store a thing
> that is actually a long in a void*, so I think that we only really need
> the void* to be as big or bigger than a long.
>
> But with recent gcc variants, that will not fly without some fancy
> casting or...
>
> I don't know what's best. Maybe we should just create a union that holds
> a void* and a long and use that to convert the user_data back and forth.
as a simplest way is to use typedef, like this
#ifdef _WIN64
typedef fl_long intptr_t
#else
typedef fl_long long
#endif
and change some places
typedef void( Fl_Callback1 )(Fl_Widget *, fl_long)
..
fl_long argument() const {return (fl_long)user_data_;}
..
etc
this don't break old code and only in case of porting to Win64
somebody will need change casting from (long) to (fl_long)
>
> Any ideas? Answers on a postcard please.
>
>
>
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev