Skip to content

Commit cdf941e

Browse files
chore: fix unused variable in ffi example (#1825)
# What does this PR do? This PR fixes an unused variable (`c`) which happens when the code is compiled with `NDEBUG` (which I think I accidentally did when I ran FFI tests for #1733). To work around this, I extracted the `c.load` from the `assert` and then always do `std::ignore = value` so that everything is always used. Co-authored-by: thomas.kowalski <thomas.kowalski@datadoghq.com>
1 parent 32f9679 commit cdf941e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

examples/ffi/array_queue.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ int main(void) {
9696
}
9797

9898
for (const auto &c : counts) {
99-
assert(c.load(std::memory_order_seq_cst) == num_threads);
99+
auto value = c.load(std::memory_order_seq_cst);
100+
assert(value == num_threads);
101+
std::ignore = value;
100102
}
101103
}

0 commit comments

Comments
 (0)