Skip to content

Conversation

@joshlengel
Copy link

Hello!

I've been using the cute_tiled.h for a week or so and encountered multiple variable shadowing warnings in the strpool section when using MSVC (Visual Studio Community Edition 2022).

.\cute_tiled.h(994): warning C4456: declaration of 'data' hides previous local declaration
.\cute_tiled.h(951): note: see declaration of 'data'
.\cute_tiled.h(1044): warning C4456: declaration of 'entry' hides previous local declaration
.\cute_tiled.h(1017): note: see declaration of 'entry'
.\cute_tiled.h(1052): warning C4456: declaration of 'handle_index' hides previous local declaration
.\cute_tiled.h(1016): note: see declaration of 'handle_index'

Compiling the test_cute_tiled/main.cpp with /W4 emits three warnings about local variables being shadowed. Now, this is not really a problem but the solution is simple and negates the need to mess around with warning suppression. The pull request merely relocates the declaration of three local variables to the location they are first used at. As such, there should be hardly any difference in machine code besides possibly reducing the respective stack frames by a few bytes.

Thanks for the great library!

With kind regards,
Josh Lengel

@joshlengel joshlengel changed the title Fixed cute_tiled.h variable shadowing warnings on MSVC Fix cute_tiled.h variable shadowing warnings on MSVC Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant