[Bf-blender-cvs] [c69a581c0b9] master: Cleanup: avoid positional struct initialization

Campbell Barton noreply at git.blender.org
Mon Jan 24 04:27:45 CET 2022


Commit: c69a581c0b951d219f1501a8ceb7040bdf36e51c
Author: Campbell Barton
Date:   Mon Jan 24 14:09:31 2022 +1100
Branches: master
https://developer.blender.org/rBc69a581c0b951d219f1501a8ceb7040bdf36e51c

Cleanup: avoid positional struct initialization

When moving to C++ field for initialization was removed.
Favor assignments to field names as it reads better and avoids bugs if
files are ever re-arranged as well as mistakes (see T94784).

Note that the generated optimized output is identical with GCC11.

===================================================================

M	source/blender/modifiers/intern/MOD_weld.cc

===================================================================

diff --git a/source/blender/modifiers/intern/MOD_weld.cc b/source/blender/modifiers/intern/MOD_weld.cc
index 3199bdc834f..2d4710ca71a 100644
--- a/source/blender/modifiers/intern/MOD_weld.cc
+++ b/source/blender/modifiers/intern/MOD_weld.cc
@@ -386,7 +386,10 @@ static Vector<WeldVert> weld_vert_ctx_alloc_and_setup(Span<int> vert_dest_map,
 
   for (const int i : vert_dest_map.index_range()) {
     if (vert_dest_map[i] != OUT_OF_CONTEXT) {
-      wvert.append({vert_dest_map[i], i});
+      WeldVert wv{};
+      wv.vert_dest = vert_dest_map[i];
+      wv.vert_orig = i;
+      wvert.append(wv);
     }
   }
   return wvert;



More information about the Bf-blender-cvs mailing list