Nuklear
Nuklear copied to clipboard
warning C5054: operator '|': deprecated between enumerations of different types
1>F:\my_games\dviglo2d\repo\third_party\external\nuklear\repo\nuklear.h(3719,37): warning C5054: operator '|': deprecated between enumerations of different types
1>(compiling source file '../../../repo/apps/nuklear_demo/src/app.cpp')
1>F:\my_games\dviglo2d\repo\third_party\external\nuklear\repo\nuklear.h(5622,47): warning C5054: operator '|': deprecated between enumerations of different types
1>(compiling source file '../../../repo/apps/nuklear_demo/src/app.cpp')
1>F:\my_games\dviglo2d\repo\third_party\external\nuklear\repo\nuklear.h(5623,42): warning C5054: operator '|': deprecated between enumerations of different types
1>(compiling source file '../../../repo/apps/nuklear_demo/src/app.cpp')
1>F:\my_games\dviglo2d\repo\third_party\external\nuklear\repo\nuklear.h(5715,46): warning C5054: operator '|': deprecated between enumerations of different types
1>(compiling source file '../../../repo/apps/nuklear_demo/src/app.cpp')
NK_EDIT_FIELD = NK_EDIT_SIMPLE|NK_EDIT_SELECTABLE|NK_EDIT_CLIPBOARD,
NK_PANEL_SET_POPUP = NK_PANEL_SET_NONBLOCK|NK_PANEL_POPUP,
NK_PANEL_SET_SUB = NK_PANEL_SET_POPUP|NK_PANEL_GROUP
NK_WINDOW_NOT_INTERACTIVE = NK_WINDOW_ROM|NK_WINDOW_NO_INPUT,
C++ will expect a static_cast between the types. Unsure of the best approach here. Perhaps a macro that handles the change between C vs C++?
C-style casts to basic types expected by the particular call sites would silence the warnings and would be C89 as well as C++ compliant.
Example:
nk_do_edit(ws, out, edit, (nk_uint)NK_EDIT_FIELD|(nk_uint)NK_EDIT_AUTO_SELECT,
filters[filter], text_edit, &style->edit, (*state == NK_PROPERTY_EDIT) ? in: 0, font);
Would this be an accepted solution?
Question: why these constants come from different enumeration types? Shouldn't it either 1) be a single enumeration 2) be a function that accepts 2 enumerations?
For GLFW I have just disabled this warning for now in nuklear: https://github.com/glfw/glfw/commit/d30d63313c5876f9ce8770f79cd59dd7109a768e