3 ms·
Comes from the null==val idiom, and that comes from avoiding the popular "if (val=null)" bug in C/C++. Sure, we could just admit that assignments in conditions
by groby_b 5y ago
Comes from the null==val idiom, and that comes from avoiding the popular "if (val=null)" bug in C/C++.
Sure, we could just admit that assignments in conditions are a permanently stupid idea. Instead, an entire industry backwards the conditions wrote.
- account42 5y agoI find initializing condtions like `if(Type variable = ...)` to be very nice in C++ to avoid excessive nesting while still keeping the variable scoped to the block. Of course, I also enable -Wparentheses for things like `if(val=null)`, which you get e.g. when using -Wall with both GCC and Clang.