ext_133243 ([identity profile] tenax.livejournal.com) wrote in [personal profile] vakkotaur 2004-12-02 08:24 pm (UTC)

Well, depends on exactly what they're comparing to. For example

typedef BOOL int;
#define TRUE -1 /* Or some other, non-zero constant */
#define FALSE 0

BOOL bResult1 = FunkyFunction();
bool bResult2 = FunkyFunction();


For bResult2, it can only have the values "true" and "false". For bResult1, it is possible to have a non-zero value that isn't TRUE. So:

if (bResult1) DoFoo();
if (bResult1 == TRUE) DoBar();


Means that DoFoo() may be called in cases where DoBar() would not.

Personally, I really like Python's definition. 0-length strings, empty lists, empty tuples, the value 0, the value False, and the None value are all considered false. All other values are true.

Bah, look what you made me do! I've spewed geekery all over Vakko's LJ entry.

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting