From: "Mark J. Reed" Date: 2003-09-18T00:03:18+09:00 Subject: Re: Ruby and OOP-design (question of an old "procedural person" ;) On Mon, Aug 11, 2003 at 08:44:23AM +0900, Dan Doel wrote: > I'm not sure about C, but I would assume it is, because there's no > booleans in C so it'd be totally useless > as it would do the exact same thing as &. No, it wouldn't. C doesn't have a Boolean *type*, but it does have the idea of truth and falsehood (needed for if statements, etc). Nonzero is true and zero is false. Which means that this expression: 1 & 2 is false - bitwise AND of 1 and 2 yields 0. Whereas 1 && 2 is true, because both 1 and 2 are true (nonzero). The big difference in C is that the double-characters are LOGICAL operators, while the single ones are BIT operators. However, it happens that the logical operators in C and derivatives also short-circuit, which means you can do things like if (p != NULL && strcmp(p->value, key)==0) { and not worry about the program blowing up because the strcmp() is called when p is NULL. -Mark