develooper Front page | perl.perl5.porters | Postings from June 2012

Re: Time for a 64-bit perl API?

Thread Previous | Thread Next
Rev. Chip
June 16, 2012 21:34
Re: Time for a 64-bit perl API?
Message ID:
On Sun, Jun 17, 2012 at 12:33:36AM +0200, Josh Hurst wrote:
> Is there a way to have a API which is independent of the pointer or
> word size?

Yes, but it will take some care.  The compiler will ensure that size_t,
ssize_t (actually we must use the Perl alias SSize_t), ptrdiff_t, intptr_t
(if present), and I think a few more ANSI and POSIX types will all scale up.
So when we introduce them into the API, scaling up is automatic.

For the most part I think we just need to use size_t and SSize_t where we
currently use U32 and I32.  Given that our code runs on 32-bit machines, it
is likely that overflow-related errors in function bodies will be minimal.

In some cases IV/UV may be the best choice, as they are the Perl ecosystem's
best equivalent to intptr_t.  But I would prefer to see a new Perl Intptr_t,
which is precisely the minimal integer that can hold a pointer.  No point in
making a variable bigger than necessary.
Chip Salzenberg

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About