[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: snmpconf



On Wed, 25 Oct 2000 17:58:47 -0500, Mike_Ayers@bmc.com wrote:
 >{8.1.1.3. exists()} 9.) This function and many following
 >return 1 for success and 0 for failure, the reverse of the C
 >convention.

Not so. In a boolean context, C defines false as zero and true as 1. 
(Actually, any non-zero value is true). The exists() function (and most of 
the other boolean functions) do not return success and failure (which are 
not defined in C) but true or false. If you were to write:

   if (exists("1.2.3.4.5.6.7"))
     blah();

you would expect blah() to be executed if 1.2.3.4.5.6.7 exists. Exists must 
return non-zero (true) for this situation.  Compare to Standard C:

   if (is_upper(c))
     blah();

will execute blah() if is_upper() returns 1, i.e. if c is an upper-case letter.



- Pablo
---------------------------------------------------------------------
Pablo Halpern                                    phalpern@newview.org
http://www.halpernwightsoftware.com