3 ms·
for (auto foo : list) assert(foo); The problem is that the assert() macro disappears in release mode, causing foo to trigger an unused variable warning. You ne
by nyanpasu64 6y ago
for (auto foo : list) assert(foo);
The problem is that the assert() macro disappears in release mode, causing foo to trigger an unused variable warning. You need to (void)foo; as well.
On a related note, since assert() is removed in release mode, assert(fn_with_side_effects()) will fail to run the function in release mode. You need to separate it into two lines.