John:

If I understand your code,  "v" is a pointer to a so-called null string and C 
does not allow it to be a NULL (char * 0).   Therefore I would expect 
_tmp65803  to be returned as a pointer to the Value (0) associated with the string "".
It would be a NULL pointer if an error occurred.

I.E. to get an error in the below code try:
JudySLIns((PTF index), (unsigned char*)0, _tmp65802);

Thank you for your interest,

doug

P.S.  Pointers to pointers drive me crazy too.

 
Doug Baskins <dougbaskins@yahoo.com>


From: john skaller <skaller@users.sourceforge.net>
To: judy <judy-devel@lists.sourceforge.net>
Cc: felix google <felix-language@googlegroups.com>; felix sf <felix-language@lists.sourceforge.net>
Sent: Thursday, July 4, 2013 6:39 AM
Subject: weird bug

I must be missing something but I have this code using JudySLIns:

      {

printf("Judy Array at address %p = %p\n", PTF index, *PTF index);
      char* _tmp65801 = v ;

      JError_t* _tmp65802 = (JError_t*)&_i52588_v52588_err;
      _a12095t_65459** _tmp65803 = (_a12095t_65459**)((void****)&slot);

printf("CALLING INSERT key = %s\n", _tmp65801);     
      if (::std::strlen(_tmp65801) >= JUDY_SL_MAXLEN) throw "JudySLIns strlen>10000";
      *(Word_t**)_tmp65803=(Word_t*)JudySLIns((PTF index),(unsigned char*)_tmp65801,_tmp65802);
   
printf("INSERT DONE _tmp65803=%p, &slot=%p,slot=%p,*slot=%p, error=%d\n", _tmp65803, &slot,slot,*slot,(int)_i52588_v52588_err.je_Errno);

      }

and my output is:

Judy Array at address 0x1001033b0 = 0x0
CALLING INSERT key = isNULL
INSERT DONE _tmp65803=0x100101120, &slot=0x100101120,slot=0x100132450,*slot=0x0, error=0

in other words, JudySLIns returns NULL but there's no error code.
There's also no reason I can think of for JudySLIns to return NULL
if given valid arguments: it either finds an existing key and returns the
data slot address or it creates a new one.

In this case, the JudySLArray is a virgin (NULL).

The code above was generated. With some tweaks to my compiler
input different C++ code is generated, and that code actually works.

Any thoughts on what the error could possibly be?
[Apart from the horrible obvious .. corruption someplace else..]

--
john skaller
skaller@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Judy-devel mailing list
Judy-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/judy-devel