lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] [PATCH] Trivial patch to avoid variable shadowing warning


From: Vadim Zeitlin
Subject: [lmi] [PATCH] Trivial patch to avoid variable shadowing warning
Date: Sat, 28 Jan 2017 17:32:15 +0100

 Hello,

 Now that for-loop-related changes are done, I can finally submit a trivial
patch that was sitting in my local tree since quite some time but that I
didn't want to submit before to avoid conflicts with other, more important
changes:
---------------------------------- >8 --------------------------------------
diff --git a/dbdict.cpp b/dbdict.cpp
index dfe75f5..bfca4cb 100644
--- a/dbdict.cpp
+++ b/dbdict.cpp
@@ -1083,9 +1083,9 @@ void print_databases()
 
             fs::path out_file = fs::change_extension(*i, ".dbt");
             fs::ofstream os(out_file, ios_out_trunc_binary());
-            for(auto const& i : z.member_names())
+            for(auto const& j : z.member_names())
                 {
-                z.datum(i).write(os);
+                z.datum(j).write(os);
                 }
             }
         catch(...)
---------------------------------- >8 --------------------------------------

 This simply renames the loop variable to avoid shadowing the "i" iterator
in outer scope and thus fixing MSVS 2015 warning as well as making the code
more clear (IMHO) because the same name doesn't refer to 2 completely
different things any more.

 Thanks in advance for applying it,
VZ


reply via email to

[Prev in Thread] Current Thread [Next in Thread]