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
This commit is contained in:
John Reiser 2022-05-30 15:09:34 -07:00 committed by Markus F.X.J. Oberhumer
parent a68c62d938
commit 717150b7f3

View File

@ -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