DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New] Link: http://www.fltk.org/str.php?L2308 Version: 1.3.0 Possibly the sugg of using a union was for conversion from long <-> void* only in the argument() method, eg: #include <stdio.h> class Fl_Widget { void *userdata; public: Fl_Widget() { userdata = 0; } void argument(long val) { union { void *v; long l; } vl; vl.l = val; // convert long.. userdata = vl.v; // ..to void* } long argument() const { union { void *v; long l; } vl; vl.v = userdata; // convert void*.. return(vl.l); // ..to long. } }; int main() { Fl_Widget w; w.argument(305419896L); // aka. 0x12345678 printf("Arg=%ld (%lx)\n", w.argument(), w.argument()); printf("sizeof(void*)=%lu\n", sizeof(void*)); printf(" sizeof(long)=%lu\n", sizeof(long)); return(0); } Even if sizeof(long) < sizeof(void*) that should work. (I tried above technique with a char <-> void* instead of long to simulate that condition, and seemed to compile/run OK on linux and windows) Link: http://www.fltk.org/str.php?L2308 Version: 1.3.0 _______________________________________________ fltk-bugs mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-bugs
