Lorenz Minder on Wed, 11 May 2011 05:53:56 +0200

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

Re: allocatemoremem() backwards compatibility

Hi Bill,

Bill Allombert wrote:
> On Tue, May 10, 2011 at 09:57:10AM +0200, Jeroen Demeyer wrote:
> > Hello,
> > 
> > Does the libpari function allocatemem() behave the same as the old
> > function allocatemoremem()?
> Not really. allocatemem() end with cb_pari_err_recover(), while
> allocatemoremem() did not.

That's great news, and I will update my code if I get around to.
(Unfortunately I have rarely time for that nowadays.)

> > I think you should add a declaration in pariold.h for allocatemoremem().
> >  Some external programs use that function.
> allocatemoremem() was removed because it was not safe to use in most case.
> Also the documentation stated that it returned void, while in fact it was returning
> a long.
> How did you use that function ?

I use it in a snippet like this:


Here, stack_clean() clones every live object residing on the stack, and
stack_init() does essentially an "avma = top;" (in addition to
implementing a workaround for a pari < 2.4.3 bug).  Is this a safe use
(if we ignore the possibility that allocatemoremem() might not actually
manage to allocate memory)?