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>
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 mails | Author | Date |
|---|---|---|
| Eyal Redler | Aug 31, 07:30 | |
| Charles Steinman | Aug 31, 08:19 | |
| John Stiles | Aug 31, 19:02 | |
| Clark Cox | Aug 31, 20:00 | |
| Clark Cox | Aug 31, 20:07 | |
| Charles Steinman | Aug 31, 20:28 | |
| Eyal Redler | Sep 1, 07:34 | |
| Scott Ribe | Sep 6, 05:03 | |
| glenn andreas | Sep 6, 05:24 | |
| John Stiles | Sep 6, 05:32 | |
| Clark Cox | Sep 6, 07:15 | |
| Wincent Colaiuta | Sep 6, 12:47 | |
| j o a r | Sep 6, 13:24 | |
| Scott Ribe | Sep 6, 16:02 |






Cocoa mail archive

