Bill Allombert on Thu, 17 Oct 2002 21:40:07 +0200


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

Re: functions returning int with 'l' protocodes.


On Thu, Oct 17, 2002 at 12:13:06PM -0700, Ilya Zakharevich wrote:
> On Thu, Oct 17, 2002 at 08:58:21PM +0200, Bill Allombert wrote:
> > > On needs one letter for input, another for output.
> > 
> > For now, only output is neccessary. And since we are going to redesign
> > the system, it is not a high priority to allow installed functions
> > to take an int. Especially since there is no 't_INT to C int' conversions
> > routines in GP.
> 
> Sorry, but I can't consider this objection seriously.  Certainly you
> know how to convert a long to an int in C?  ;-)
Yes I do. But there is still no functions to do it in GP.
> 
> And all the error-handling is in
>   if (l != (long)i)
> 	err(....)

Sorry I do not understand what you mean. Should not it be

  long l=stoi(x);
#ifdef LONG_IS_64BIT
  if (l != (int)l)
    err(talker,"integer too large in stoint");
#endif

OK that is not that hard to implement, but there is no need of it currently.

> > Even, I would not encourage the use of 'int' for whatever
> > in PARI. Currently functions with return type 'int' are comparaison functions
> > which only return either -1, 0 or 1.
> 
> Looks like you forgot about install()...

Not at all, read my first paragraph.

Cheers,
Bill.