On Nov 28, 2007, at 6:22 PM, Stephen Deasey wrote:

> Pre-change:
>
>
> % expr !1
> 0
> % expr !0
> 1
>
> % expr !true
> 0
> % expr !yes
> 0
> % expr !y
> 0


set value [ns_config -bool /missing/section missing_parameter true]
if {$value == 1} {
    puts "$value is true"
} else {
    puts "$value is false"
}

What do you think the above will print out?

The problem is that the programmer could test
the value on 0/1 as well, so more defensive way
is to return canonical value's of 1/0 for
true/false boolean values. The code before
retured whatever the value has been given
(y/Y/true/Yes etc pp) which broke some of our
code (that costed us *hours* to dig it out!!!)

The code was broken at that place definitely.
The change fixed that but broke the integer part...
I will look into that now....

Cheers
Zoran


-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to