Skip navigation.
 
mlRe: ObjC BOOL and boolean c expressions
FROM : Clark Cox
DATE : Fri Aug 31 20:00:35 2007

On 8/31/07, John Stiles <<email_removed>> wrote:
> I *think* that the C spec doesn't specify the result of a boolean
> expression other than "zero means false, nonzero means true."


No, *all* of C's operators that return a boolean result return either
1 or 0. So the result of any of:

(==,!=,<,>,<=,>=,!,&&,||)

will never be anything but 1 or 0. This is also true in C++ (unless
one of the operators is overloaded to do something else).

--
Clark S. Cox III
<email_removed>

Related mailsAuthorDate
mlObjC BOOL and boolean c expressions Eyal Redler Aug 31, 07:30
mlRe: ObjC BOOL and boolean c expressions Charles Steinman Aug 31, 08:19
mlRe: ObjC BOOL and boolean c expressions John Stiles Aug 31, 19:02
mlRe: ObjC BOOL and boolean c expressions Clark Cox Aug 31, 20:00
mlRe: ObjC BOOL and boolean c expressions Clark Cox Aug 31, 20:07
mlRe: ObjC BOOL and boolean c expressions Charles Steinman Aug 31, 20:28
mlRe: ObjC BOOL and boolean c expressions Eyal Redler Sep 1, 07:34
mlRe: ObjC BOOL and boolean c expressions Scott Ribe Sep 6, 05:03
mlRe: ObjC BOOL and boolean c expressions glenn andreas Sep 6, 05:24
mlRe: ObjC BOOL and boolean c expressions John Stiles Sep 6, 05:32
mlRe: ObjC BOOL and boolean c expressions Clark Cox Sep 6, 07:15
mlRe: ObjC BOOL and boolean c expressions Wincent Colaiuta Sep 6, 12:47
mlRe: ObjC BOOL and boolean c expressions j o a r Sep 6, 13:24
mlRe: ObjC BOOL and boolean c expressions Scott Ribe Sep 6, 16:02