The compiler doesn't warn about tor_assert(a = b)
C's assignment expressions are notoriously easy to mis-type when you are trying to enter an equality expression instead. Most compilers will notice when you say something like if (a = b)
, and make you add an extra set of parentheses. But we've done something with our tor_assert() macro so this doesn't happen. We should fix that.
Found from ahf's review of #27289 (moved)
We should also make sure BUG doesn't have this problem.