Skip to content

Fix: Cast loop variable to ImU32 in ImPlot3DColormapData to fix C4365 warning#176

Merged
brenocq merged 1 commit intobrenocq:mainfrom
darkvisiontech:fix-msvc-warning-c4365-signed-unsigned
Feb 20, 2026
Merged

Fix: Cast loop variable to ImU32 in ImPlot3DColormapData to fix C4365 warning#176
brenocq merged 1 commit intobrenocq:mainfrom
darkvisiontech:fix-msvc-warning-c4365-signed-unsigned

Conversation

@JunkyoLee
Copy link
Contributor

The build error

In implot3d_internal.h line 266, the for-loop counter s is declared as int but is passed directly to ImMixU32(ImU32, ImU32, ImU32), causing a C4365 signed/unsigned mismatch warning on MSVC. When warnings are treated as errors (e.g. /W4 /WX builds), this breaks compilation.

implot3d/implot3d_internal.h(266,56): error C2220: the following warning is treated as an error
                    ImU32 c = ImPlot3D::ImMixU32(a, b, s);
                                                       ^
implot3d/implot3d_internal.h(266,56): warning C4365: 'argument': conversion from 'int' to 'ImU32', signed/unsigned mismatch

Fix (applied): Cast s to ImU32

Instead of suppressing this warning, I addressed the root cause in the code to ensure a more robust solution.

// Before
ImU32 c = ImPlot3D::ImMixU32(a, b, s);
// After
ImU32 c = ImPlot3D::ImMixU32(a, b, (ImU32)s);

Alternative considered: Changing the loop variable itself to ImU32:

for (ImU32 s = 0; s < 255; ++s) {

@JunkyoLee JunkyoLee requested a review from brenocq as a code owner February 19, 2026 18:51
@github-actions github-actions bot added the status:review The task is under review label Feb 19, 2026
Copy link
Owner

@brenocq brenocq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the fix @JunkyoLee!

@brenocq brenocq merged commit c4d5922 into brenocq:main Feb 20, 2026
5 checks passed
@github-actions github-actions bot added status:done Task completed successfully and removed status:review The task is under review labels Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:done Task completed successfully

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants