marty wrote:
long li = (long)v; works fine.
Yes; this is a good option, everywhere *except* Win64... On Win64, a long is
still only 32-bit (everyone else decided that in their 64-bit generation a long
would be 64-bits, but MS decided they needed to preserve the sizeof(long) ==
sizeof(int)
Hi all,
Please excuse another newbie question.
I'm looking at storing an enum as user data in an Fl_Menu_Item user data. In
the callback, I want to access the enum.
I know that I can put the enum into user data as a string:
enum eop { task0=200, task2, task3};
Fl_Menu_Item menu = {
{ thing 1,
Assuming this is readable this time... (and not more B64 nonsense...)
I'm looking at storing an enum as user data in an Fl_Menu_Item user
data. In the callback, I want to access the enum.
I know that I can put the enum into user data as a string:
enum eop { task0=200, task2, task3};
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
On 04/03/13 09:05, Ian MacArthur wrote:
void mycallback(widget* w, void* v) {
eop e = (eop) (atoi((char*)v));
What is it you are trying to do here?
Probably trying to sidestep the 'precision loss' error from the
newer compilers due to sizeof(void*) != sizeof(int).
On Wed, 03 Apr 2013 09:34:22 -0700, Greg Ercolano e...@seriss.com
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
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.
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
Hi,
thanks for all the info! I really appreciate the response.
I tried your suggestions on my system: Debian 6.5 (64 bit), gcc-4.4.5, emacs
23, fltk-1.3.2
I tested the following:
eop op = (eop)fl_intptr_t(v); works fine
int i = (int)v; fails to compile (loss of precision) like you all said.
On 04/03/13 13:22, marty moore wrote:
long i = (long)(w-argument()); compiles, but always results in '0'.
Doesn't w point back to the Fl_Menu_Button that had the menu?
Probably depends on if you're setting the callback for the widget,
or the callback for the items.
Each
10 matches
Mail list logo