roxen.lists.pike.general

Subject Author Date
Re: overloading + Henrik_Grubbström <grubba[at]roxen[dot]com> 10-02-2009
On Fri, 23 Jan 2009, Marc Dirix (Electronics Design) wrote:

>
>> Looks like it has run out of C-stack, due to an infinite recursion
>> which in turn looks like it has probably been triggered by f_add()
>> throwing an error. The likely reason for f_add() throwing an error
>> is that there's some sort of problem with your lfun::`+() or
>> lfun::`+=().
>>
>> Can you give an example of the code that fails?
>>
>
> I know the code I use is wrong, that's why I started the thread as I'm
> still searching how it should be done properly. During trial and error
> the overloading segfaulted, on which I sent the gdb output as requested.
>
> The faulting code is (it executes the "werror" call, then it segfaults:
>
> mixed `+(mixed a, int ... more)
> {
>   //UID COPY 558140 "mailbox"
>     werror("+ called with %O\n",a);
> //  command_cb("UID","COPY",a,name);
>   return this_object();

NB: `+() should typically never return this_object(); that's what `+=()
     should return.

> }

Sorry, I can't reproduce the segfault with just the above code.

Can you send a more complete example?

> Regards,
>
> Marc

--
Henrik Grubbström					<grubba[at]roxen.com>
Roxen Internet Software AB