Re: bug in simplify_shallow

"Ruud H.G. van Tol" <[email protected]>
Newsgroups gmane.comp.mathematics.pari.devel
Message-ID <[email protected]>
On 2023-09-30 14:32, Karim Belabas wrote:
> * Bill Allombert [2023-09-30 13:27]:
>>> P.S. In paridecl.h, comparing listpop:
>>>
>>>   void    listpop(GEN L, long index);
>>>
>>> shouldn't these now also be void?
>>>
>>>   GEN     listinsert(GEN list, GEN object, long index);
>>>   GEN     listput(GEN list, GEN object, long index);
>>>
>>> (or does GEN cover that already?)
>> GP uses listinsert0 and listput0 which returns void.
>> I have kept the return value for the C functions.
> And in that case, it makes sense: it returns the 'clone' of the input
> object, as was inserted in the list, which is not readily available to
> the caller.
>
> - GP can't use this information (without lots of precautions).
> - passing to these functions an input value which is alread a safe clone
>    is wasteful since we must first validate that 'list' is an actual list
>    in which we can insert things (and if not we might have a memory
>    leak or have to clean up in the error handler...)
>
> The current situation is fine.

OK, that cleared up my fog, thanks for persisting.

-- Ruud
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.