Immediate-Mode-UI / Immediate-Mode-UI/Nuklear
Incorrect returned value in nk_group_scrolled_offset_begin
- Dominant language
- C
- Stars
- 11.4k
- Forks
- 686
- Avg merge
- 4d 1h
- Merged PRs (30d)
- 3
Description
As of version 4.10.6, compiling `nuklear.h` with `#define NK_INCLUDE_STANDARD_BOOL` yields the following warning:
`enum constant in boolean context [-Wint-in-bool-context]`
The issue stems from `NK_API nk_bool nk_group_scrolled_offset_begin()`:
```
if (f & NK_WINDOW_CLOSED)
return NK_WINDOW_CLOSED;
if (f & NK_WINDOW_MINIMIZED)
return NK_WINDOW_MINIMIZED;
```
Given that the function is expected to return "`true(1)` if visible and fillable with widgets or `false(0)` otherwise", I'm guessing the two `return` should be merged into a single return `false` instead? Currently the conversion from the `nk_window_flags` enum to `bool` would return `true`.
Contributor guide
Research direction
Inspect nk_group_scrolled_offset_begin in nuklear.h and its documented boolean return contract. Compile with NK_INCLUDE_STANDARD_BOOL to reproduce the warning, then verify the visible, minimized, and closed-window cases return the documented values and that the warning is gone.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100