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

duplicated sizeof checks in src/nuklear_internal.h

Open
#889 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
11.4k
Forks
686
Avg merge
4d 1h
Merged PRs (30d)
3

Description

Follow up from https://github.com/Immediate-Mode-UI/Nuklear/pull/884#discussion_r2750159640

> https://github.com/Immediate-Mode-UI/Nuklear/blob/a329721db93eb336f8eaae20f9c822730dd2ed6c/src/nuklear_internal.h#L61-L75
>
> I wonder why do we need these duplicated checks here? The ones from `src/nuklear.h` do the very same thing, and all src/*.c files are including both of those headers, so I'm not sure what is the benefit?
>
> This thing can only really harm us, just like in case of #185 where the `sizeof(nk_bool)` checks were different between each file, and went unnoticed for so long.

In theory having some duplication in `src/nuklear_internal.h` may make sense, but in practice those checks just do nothing. The proper sizes are already ensured at the moment when any of those is hit. This just looks like a dead code to me at this point.

I'm planning to remove this unless someone has a good reason to keep it (?)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the checks at src/nuklear_internal.h lines 61-75 with the corresponding checks in src/nuklear.h, then inspect how the src/*.c files include both headers. Remove the redundant checks if no distinct purpose remains, and verify that the project still builds with the same size validations.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
desktop
Issue type
Refactor
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.