John:
----- Original Message ----
>> Judy returning a -1 in the "pointer to value" word do so because:
>>
>> 1) There was a malloc(2) failure.
>> 2) There was a Judy array corruption.
>> 3) There was a programming mistake.
> Are you sure? Because I have correct code, which doesn't work
> UNLESS I also check for the "-1 in a pointer".
> That was the problem I had. I was checking ONLY for NULL,
> and I was getting a segfault .. it turned out to be the -1
> was returned..
...
> If you're right, I can remove the -1 check. (But I tried that,
> and stuff failed which works with the check .. if my code
> was bugged it wouldn't work, even with the check..)
NO, the -1 return is an "error flag" that says "check the error structure"
for the type of error.
...
> One solution is to provide an error function HOOK, this is a user
> supplied function like:
...
The macro interface has the hooks for adjusting how errors are handled.
During development, I have it print out all errors, and then during
production code, just malloc(2) failures.
...
> You already have an allocator hook, right?
Yes, take a look at JudyMalloc, JudyMallocVirtual, JudyFree and
JudyFreeVirtual in test/Judy1LHTime.c All memory allocation
goes thru these routines. This is how Judy1LHTime calculates
how much memory Judy uses.
> The functions are the critical thing. The standard judy header
> shouldn't contain the 'convenience' macros, put them in
> another header so they can be used or not at the client's
> discretion.
...
Good suggestion, perhaps you should read the error section in Judy_3x man
page. (also Judy_3x.htm#ERRORS). It starts off: "A lot of thought (and time)
went into making error handling in Judy
simple, ...". It violates my 1 screen full
of stuff -- it is 2 screen fulls. Please re-write it if it is not clear to you
and I will
publish it.
>> The latest wrinkle with C++ not compatible with Judy is troublesome
>> for me.
> I forget what that is?
Word_t *abc = (void *)JudyLGet();
is an error in C++, even though both are pointers. I thought void * was a
pointer to anything you wanted to make it.
> --
> John Skaller <skaller at users dot sf dot net>
> Felix, successor to C++: http://felix.sf.net
Doug Baskins
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Judy-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/judy-devel