Immediate-Mode-UI / Immediate-Mode-UI/Nuklear
duplicated sizeof checks in src/nuklear_internal.h
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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