RE: Lives there a boolean integer?

Subject: RE: Lives there a boolean integer?
From: "Geoff Lane" <geoff -at- gjctech -dot- co -dot- uk>
To: "'Mark L. Levinson'" <markl -at- gilian -dot- com>, "'TECHWR-L'" <techwr-l -at- lists -dot- raycomm -dot- com>
Date: Tue, 7 Mar 2000 10:01:33 -0000

Mark L. Levinson wrote:
> I'd like to hear from people who are familiar with
> C and with Perl. I'm documenting a number of functions
> that return the integer 1 to indicate success and the
> integer 0 to indicate failure. Because these are the
> only two values ever returned, I'm being encouraged
> to refer to them as boolean values, and I'm
> being told that there's no real confusion involved
> because neither C nor Perl supports a true boolean
> data type.

FWIW, I have a similar situation with the product API that I'm currently
documenting. This product treats zero as false and non-zero values as true.
When it returns TRUE, it uses the value -1 (many compilers and interpreters
use -1 because, in two's complement, every bit is set).

There is a way that you can stand by your principle *and* meet the
programmers wishes -- just state that the product *represents* the Boolean
values TRUE and FALSE by non-zero and zero values respectively. In addition,
this may help when you come to explain bitwise operations (where each bit is
considered a separate value). Set (non-zero) bits represent TRUE; cleared
(zero) bits represent FALSE.


Geoff Lane
Cornwall, UK
geoff -at- gjctech -dot- co -dot- uk

Previous by Author: RE: IP addresses/domain names at the end of a sentence
Next by Author: RE: Corel Office Suite 2000 and pdf
Previous by Thread: Re: Lives there a boolean integer?
Next by Thread: re: Lives there a boolean integer?

What this post helpful? Share it with friends and colleagues:

Sponsored Ads

Sponsored Ads