Fix cute_tiled.h variable shadowing warnings on MSVC #414
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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