Web Development Blog

24K Design Studio :: Blog :: Precedence difference between C and MySQL
Author:
Password:
Precedence difference between C and MySQL
07:28, 14 Oct, 2010
by David

In MySQL, sometime we may write
where `attrib`&1=0
It means the LSB of `attrib` is 0.
However, it is different in C, because = have a higher precedence there, and we must use (attrib&1)==0 in C.
We'd better say, for those who is used to that [= have a higher precedence than & in C], it is more natural in MySQL and that bracket can be removed.

Reference:
Precedence in C: http://www.difranco.net/cop2220/op-prec.htm
Precedence in MySQL: http://dev.mysql.com/doc/refman/4.1/en/operator-precedence.html

Tags: MySQL C
Reply:
Your name:
Only visible to the author.

Tell us you are not a robot. What is captcha1captchaOcaptcha2

Reply
View the latest 5 entries.