4 ms·
Wrong. In C and C++, == has a higher precedence than && and ||, so `A && B == C && D` parses as `A && (B == C) && D`.
by Denvercoder9 3y ago
Wrong. In C and C++, == has a higher precedence than && and ||, so `A && B == C && D` parses as `A && (B == C) && D`.
- elromulous 3y ago== is really just a logical xor anyway.
- adwn 3y agoYou mean "xnor", right? It's the != operator which corresponds to xor.
- elromulous 3y agoI did! Thanks.
- laxd 3y agoWrong? Did'nt ask how C does it and clearly you did not understand my simple comment. Wtf is going on with hn? It's turning into yet another site were kids think they seem smart by intentionally misinterpreting and bickering.
- pi-e-sigma 3y agoWTF? Seriously, just check any C/C++ reference, equality operator has higher precedence than any logical or bitwise one.
- Denvercoder9 3y agoI interpreted GP's comment as asking what the precedence of == was (assumably in C, given that we're discussing a post by Dennis Ritchie). On second read it could also be interpreted as asking what a good precedence for == would be, in which case you're absolutely right. Sorry about that.
- laxd 3y agoOn second read I C your point given the context. Got triggered because I feel hn is downhill lately. Cheers!