Date: Thu, 18 Oct 2001 21:24:33 -0400 Message-Id: <200110190124.f9J1OXM05626@envy.delorie.com> From: DJ Delorie To: djgpp AT delorie DOT com In-reply-to: <9qnuii$kn8$1@tron.sci.fi> (traveler@netti.fi) Subject: Re: Making C++ little easier to beginners... References: <9qmkrh$581$1 AT tron DOT sci DOT fi> <9qmlmq$lou$1 AT News DOT Dal DOT Ca> <9qnuii$kn8$1 AT tron DOT sci DOT fi> Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > Please read a good Boolean algebra book to see that there really is > no difference between "logical" AND/OR and "bit" AND/OR. Except DJGPP doesn't compile good boolean algebra books, it compiles C (well, and other languages). In C, logical and bitwise operators are different. 0x52 && 0x1f => 1 0x52 & 0x1f => 0x12 The difference is whether the individual bits of the value are handled independently, or if the whole value is treated as a single boolean (zero vs non-zero). Try and see: int main() { printf("&& %d\n", 0x52 && 0x1f); printf("& %d\n", 0x52 & 0x1f); return 0; } It's even more significant with certain pairs: 0x0f && 0xf0 => 1 0x0f & 0xf0 => 0