Hacker News new | ask | show | jobs
by leereeves 894 days ago
Why was it important to allow you to write:

    if (a==b & c==d)
I always thought using the bitwise operator as if it were a logical operator was simply a mistake, even though it works because false is 0 and true is 1.

Edit: Mea culpa for reading and responding to the comments before the article.

2 comments

Because before there was && the & was used to mean the same as && does today. This happened when the context was Boolean such as an if.
I think at that point in C's development && and || did not exist: the bitwise were the only options.