You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm wrapping this library into C++ (mostly for ease of use, reduced verbosity and increased code productivity; might release the code at some point) and I have noticed that const is rarely used.
Now, I know this is an immediate mode library and thus any widget-producing function can not have const nk_context* but many getter-only functions such as xxx_get_scroll for sure can take const context.
There are also minor issues in some specific functions, e.g.:
nk_combo, nk_combobox and all related functions should take const char *const *, not const char ** as neither the strings nor the array is modified
I know very little internals of the library, but this issue is purely on the abstraction level so I should be able to make a PR. This would not be a breaking change. Any thoughts?
The text was updated successfully, but these errors were encountered:
I have noticed that a recent commit 0a28e30 is basically a revert of older commit 2e4db87. I think this is a bad change. I know that standard functions use char** but it does not make sense to return a non-const pointer to a const string.
struct nk_font* nk_font_atlas_add_from_memory(struct nk_font_atlas *atlas, void *memory, nk_size size, float height, const struct nk_font_config *config); takes a non-const pointer to the memory but looking at the implementation this memory is never modified (actually copied).
I'm wrapping this library into C++ (mostly for ease of use, reduced verbosity and increased code productivity; might release the code at some point) and I have noticed that
const
is rarely used.Now, I know this is an immediate mode library and thus any widget-producing function can not have
const nk_context*
but many getter-only functions such asxxx_get_scroll
for sure can take const context.There are also minor issues in some specific functions, e.g.:
nk_combo
,nk_combobox
and all related functions should takeconst char *const *
, notconst char **
as neither the strings nor the array is modifiedI know very little internals of the library, but this issue is purely on the abstraction level so I should be able to make a PR. This would not be a breaking change. Any thoughts?
The text was updated successfully, but these errors were encountered: