| Karim Belabas on Sat, 30 Sep 2023 14:33:02 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: bug in simplify_shallow |
* 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.
Cheers,
K.B.
--
Pr. Karim Belabas, U. Bordeaux, Vice-président en charge du Numérique
Institut de Mathématiques de Bordeaux UMR 5251 - (+33) 05 40 00 29 77
http://www.math.u-bordeaux.fr/~kbelabas/