Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

djohnny545

macrumors newbie
Original poster
Jul 2, 2010
2
0
Hi,

I recently read that Objective C 2.0 uses '|' to represent the inclusive-or bit operator and '^' to represent the or operator.

Could someone please explain the difference between inclusive-or and or?

Thanks very much!
 
| is inclusive OR (usually just OR) and gives 1 if either compared bits are 1.

^ is exclusive OR (or XOR) and differs from inclusive or in that if both compared bits are 1 the result is 0.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.