Usage rules for bare underscores

Yes, you can think of them as being assigned the arguments when the function is called.

Whether something is an lvalue or not is a syntactic property orthogonal to being _.

Personally, I don’t think in terms of lvalues/rvalues for _ (that’s the compiler’s job :wink:). I would just go with this simple heuristic: if syntax requires a variable which you would otherwise not use, feel free to rename it _.

7 Likes