FindValue return values

Ed Kleban Ed at Kleban.com
Wed Dec 21 01:30:12 CST 2005




On 12/21/05 1:20 AM, "Ruslan Zasukhin" <sunshine at public.kherson.ua> wrote:

> On 12/21/05 5:08 AM, "Ed Kleban" <Ed at Kleban.com> wrote:
> 
>>>> May return either of the above so you always have to test for both?
>>> 
>>> No. only nil. To avoid creation of object.
>> 
>> 
>> Well, the code check I put in to validate this just produced a counter
>> example proving that this is not in fact the case.
>> 
>> So... what should I conclude?  Is this a bug in Valentina?
>> 
>> ====
>> 
>> The code may be found below.
>> 
>> The debugger shows that at the point in time when the following line
>> raises an alert:
>> 
>>     return EmptyVArraySetCheck( here, result )
>> 
>> that:
>>     aVBitSet.count = 35
>>     itemRids.count = 35
>>     result is non-nil VArraySet
>>     result.count = 0
>>     result.empty = True
> 
> Ed,
> 
> A lots of code :-(


Sorry.  Most of it is comments actually ;-)

> Let's try again in short form:
> 
> You say that some FUNCTION() return you not nil as expected but Set object.
> Right?

Correct.
 
> What name of this function?

result = fItmFormRid.FindValueAsArraySet( aFormRid, aVBitSet )
 
> So do you search which must find ZERO records, right ?
> 

I do thousands of searches.  Many of them may return zero records, correct.
My main code assumes that searches will always return nil if no records are
found instead of a VArraySet with count = 0; just as you said should be the
case.

But when DebugBuild = true I trust nothing.  I don't trust RB to work right,
I don't trust Valentina to work right, and I don't trust me to code right.
So I check EVERYTHING.   And my checks discovered that FindValueAsArraySet
can return a VArraySet that is not nil and has count = 0.








More information about the Valentina mailing list