FLTK logo

Re: [fltk/fltk] VS2017 warnings when building fltk 1.4.x (58296c373a79) (#109)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: [fltk/fltk] VS2017 warnings when building fltk 1.4.x (58296c373a79) (#109) Albrecht Schlosser Feb 16, 2021  
 

While there's no warnings for me in VS 2017, looks like there's three warnings VS 2019. Not sure what to do about it ...

It's common to cast a pointer (void *) to (fl_intptr_t) and then to (int) or (long). You can find this a lot in our code, particularly with userdata stuff. The correct (but ugly) solution would IMHO be:

void setlevel(Fl_Widget*, void *value) {setlevel(int(fl_intptr_t(value)));}
void choosefract(Fl_Widget*, void *value) {choosefract(int(fl_intptr_t(value)));}
void handlemenu(Fl_Widget*, void *value) {handlemenu(int(fl_intptr_t(value)));}

I believe (IIRC) in C code you have to use the IMHO even uglier code like handlemenu((int)(fl_intptr_t)value) but in C++ you have both choices - although the latter expresses the cast more clearly rather than looking like a function call. I think it's a matter of taste.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.