arximboldi / immer

Postmodern immutable and persistent data structures for C++ — value semantics at scale
https://sinusoid.es/immer
Boost Software License 1.0
2.5k stars 181 forks source link

Fixing annoying unused local variable warning #258

Closed bobkocisko closed 1 year ago

bobkocisko commented 1 year ago

This is an issue that is showing up in Visual Studio 2022/clang-cl and due to the nature of reporting it clutters up the build output window.

arximboldi commented 1 year ago

Can you disable the warning on your compiler? I always found that this is kinda a stupid warning and the code actually is better with the name in the argument... Even though this is not the first time this comes up, so maybe I bite the bullet...

bobkocisko commented 1 year ago

Interesting! I generally prefer to leave the warning enabled because it has sometimes helped me remember to finish something I started when a variable gets left dangling. If you prefer, I could re-submit a different fix such as /* inline commenting */ the variable name or using the (void)varname trick?

khiner commented 1 year ago

Fwiw, I have also considered submitting a PR to somehow address these unused variables to help reduce the noise in my builds.

arximboldi commented 1 year ago

Ok I will accept the PR... Btw, on Linux (gcc, clang) you normally include reference libraries with -isystem <path> precisely to avoid this and on MSVC I think you can use /external:I <path>