> Albrecht Schlosser wrote: > > I don't think that a union would help, because this would maybe leave > > undefined bits in the user_data_ member, depending on the access to the > > union. > > Unused bits would be OK I think, since any code using argument() > would surely only use that method to access/read the data. > > Maybe just a warning in the docs that if you try to mix the use > of argument() and user_data() the behavior is undefined. > > To be safe, we could set user_data to zero before passing the > long into it, to ensure any 'unused bits/bytes' would be zero.
may be it will be suitable for Fl_Widget? but there is Fl_Menu_Item with the same functions. what we have to use union of Fl_Callback* and Fl_Callback1*? > > > Using casts and storing the full data size seems more appropriate > > to me. > > Yes, that's likely better, assuming there's a solid > cross platform way to do it. (intptr_t sounded like it was > 'optional'..?) > > I figure if sizeof(long) is ever != sizeof(void*), the above > problem of access will exist unless argument() is used exclusively > to manipulate the value (ie. no half-and-half use of it) > > But I defer to you guys on this. IMHO when fltk was created long not int was choosed in Fl_Callback(Fl_Widget*,long) because it has the same size as void*. if we look to glib it's defined own type gintptr with size equal size of pointer. _______________________________________________ fltk-dev mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-dev
