Bill Allombert on Tue, 15 Oct 2002 20:40:31 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: functions returning int with 'l' protocodes. |
On Tue, 10 Sep 2002, Bill Allombert wrote: > Comparison functions usually return an `int' not a `long'. > This is correct since they always returns 0, 1 or -1. > > However some of them are available from GP, but there is > not protoype letter for int, so we use l instead. > > But this is wrong, since on 64bit mechines, int is 32 bit and > long 64bit. > > On ia64 PARI compiled with gcc -g (for all versions) do not pass > the bench, because in some cases, (int) -1 became (long) 2^32-1, > which is correct, since we have hid the cast from the compiler. > > FIx involves either add a new letter code for integers, or > `upgrade' all functions return int to long. > The second option seems better. So Karim, what do you prefer ? For the stable version: the only way we can keep the ABI safe is to add a new array with the information about the output type (long or int) and to cast correctly when needed. Unfortunately this may slow GP down and is a bit ugly. Also this will be an addendum to the API, but we already done it by adding the PARI_VERSION definition, but this is not as bad, since precisely the PARI_VERSION will allows programs to know at compile time if the new array is there. Cheers, Bill