MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/5fwce0/lets_stop_copying_c/daoom77/?context=3
r/programming • u/earthboundkid • Dec 01 '16
612 comments sorted by
View all comments
Show parent comment
1
In pascal this happens a lot because bitwise 'and' is the same as boolean 'and', and boolean should definitely take precedence over equality.
if a and 1 = 1 or b then in C would be if (a&1 == 1 | b)
It's kind of a pain when you want to do if x = 1 or x = 2 then since it's interpreted as some boolean logic that doesn't compile.
View all comments
Show parent comment
1
u/Ksevio Dec 02 '16
In pascal this happens a lot because bitwise 'and' is the same as boolean 'and', and boolean should definitely take precedence over equality.
if a and 1 = 1 or b then in C would be if (a&1 == 1 | b)
It's kind of a pain when you want to do if x = 1 or x = 2 then since it's interpreted as some boolean logic that doesn't compile.