Consider:
if (a=5) {
/* do something */
}
How does the assignment work as a condition?
Is it based on non-zero value of l-value?
Consider:
if (a=5) {
/* do something */
}
How does the assignment work as a condition?
Is it based on non-zero value of l-value?
In more modern usage, you may sometimes see this pattern used to handle optionals:
std::optional x = ...;
if (auto v = x) {
// Block only executes if x contained a value, accessible as *v
}