assign_op = [ add_op | mul_op ] "=" .
binary_op = "||" | "&&" | rel_op | add_op | mul_op .rel_op = "==" | "!=" | "<" | "<=" | ">" | ">=" .add_op = "+" | "-" | "|" | "^" .mul_op = "*" | "/" | "%" | "<<" | ">>" | "&" | "&^" .unary_op = "+" | "-" | "!" | "^" | "*" | "&" | "<-" .
Assignment = ExpressionList assign_op ExpressionList .assign_op = [ logic_op | add_op | mul_op ] "=" .
binary_op = logic_op | rel_op | add_op | mul_op .logic_op = "||" | "&&" .rel_op = "==" | "!=" | "<" | "<=" | ">" | ">=" .add_op = "+" | "-" | "|" | "^" .mul_op = "*" | "/" | "%" | "<<" | ">>" | "&" | "&^" .unary_op = "+" | "-" | "!" | "^" | "*" | "&" | "<-" .
Dne 22.6.2012 17:50 "Michael Jones" <m...@google.com> napsal(a):
> 2. Why are logical operations unwelcome as assignment operators?
I guess the short-cut rules of the logical opetators are the possible reason. It would be somehow surprising that in 'v &&= expr' expr might not be evaluated at all, in contrast to all other assign-ops.
?
-j
Both email responses were clear that if "&&" can only mean (b) above, short-circuit conditional evaluation. I'm OK with that. I only wrote that to stay in the "&& for Bools" realm. I'd be happy with "&=", especially if it were allowed for bools.