Ruud H.G. van Tol on Sat, 30 Sep 2023 14:40:08 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: bug in simplify_shallow



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