Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Wrong. In C and C++, == has a higher precedence than && and ||, so `A && B == C && D` parses as `A && (B == C) && D`.


== is really just a logical xor anyway.


You mean "xnor", right? It's the != operator which corresponds to xor.


I did! Thanks.


Wrong? 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.


I 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.


On second read I C your point given the context. Got triggered because I feel hn is downhill lately. Cheers!


WTF? Seriously, just check any C/C++ reference, equality operator has higher precedence than any logical or bitwise one.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: