Immediate-Mode-UI / Immediate-Mode-UI/Nuklear

Incorrect returned value in nk_group_scrolled_offset_begin

Open
#581 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.