Sign in to follow this  
3dcgmodeling

bool and integer

Recommended Posts

Crazyfool, some languages (QBasic, probably others) define false as 0, and true as -1, since in binary 0 is all 0's and -1 is all 1's (and hence true is a binary not of false).

C and C++ however treat any value except 0 as true.

Share this post


Link to post
Share on other sites
Quote:
Original post by sphen_lee
Crazyfool, some languages (QBasic, probably others) define false as 0, and true as -1, since in binary 0 is all 0's and -1 is all 1's

Sure, if your processor does calculations in twos complement.

[Edited by - jflanglois on April 5, 2007 11:42:47 PM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this