libglui / glui

GLUI is a GLUT-based C++ user interface library which provides controls such as buttons, checkboxes, radio buttons, and spinners to OpenGL applications. It is window-system independent, using GLUT or FreeGLUT.
Other
196 stars 81 forks source link

warning fixes for newer cpp compilers #56

Closed ingowald closed 7 years ago

ingowald commented 7 years ago

Existing release contained several instances of code that produced warnings on gcc - missing 'const' in const char *-type strings, non-checked return values of fread, fscan, etc. This diff fixes those for c++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609; for which it now compiles in cmake/release without any warnings.

josch commented 7 years ago

Thanks for working on this! But this doesn't look right:

#define AssertResult(desired,expr) { int rc = expr; assert(rc == rc); }

Firstly, it would be great to only have this defined once and then include where necessary instead of having it defined in two places.

Secondly, checking for rc == rc will always succeed. You probably want to instead check whether desired == rc.

ingowald commented 7 years ago

absolutely correct. Didn't want tools/ppm to include any new header files so replicate the macro, but next pull request will include internal.h instead. the assert of course was an oversight. my fault.