From 717150b7f3d7505cb17bc15a6e8846b492fd3a48 Mon Sep 17 00:00:00 2001 From: John Reiser Date: Mon, 30 May 2022 15:09:34 -0700 Subject: [PATCH] Stupid MSVC: bad C4706: assignment within conditional expression - for (unsigned j=0; (k = dt_names[j]); ++j) { + for (unsigned j=0; ((k = dt_names[j]), k); ++j) { The complaint was: p_lx_elf.cpp(5710) : warning C4706: assignment within conditional expression which is INCORRECT, as shown in the change which is 100% equivalent. The assignment occurs BEFORE the conditional expression. modified: p_lx_elf.cpp --- src/p_lx_elf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index 763cff96..58a4fde9 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -5707,7 +5707,7 @@ PackLinuxElf64::invert_pt_dynamic(Elf64_Dyn const *dynp, upx_uint64_t headway) }; unsigned dt_offsets[sizeof(dt_names)/sizeof(dt_names[0])]; unsigned n_off = 0, k; - for (unsigned j=0; (k = dt_names[j]); ++j) { + for (unsigned j=0; ((k = dt_names[j]), k); ++j) { dt_offsets[n_off] = 0; // default to "not found" if (k < DT_NUM) { // in range of easy table if (dt_table[k]) { // present now