Re: unsinged integer

From: Date: Sat, 17 Jan 2015 05:56:52 +0000
Subject: Re: unsinged integer
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-80681@lists.php.net to get a copy of this message
On Sat, Jan 17, 2015 at 4:32 AM, Andrea Faulds <ajf@ajf.me> wrote: > Hi Marc, > > This is an unusual follow-up from me. > > Particularly on 32-bit systems, it would be useful to have a ‘u’ zend_parse_parameters > specifier for an unsigned integer. Unfortunately, again, I don’t think native unsigned integers > (IS_ULONG) will get into PHP. But it looks like the bigint RFC probably will, and here’s the > opportunity. > > With the bigint RFC, we could add a ‘u’ specifier. You’d get a native ulong (zpp would > convert from long or bigint), and could easily produce a long/bigint from your ulong if you need to > return one (add RETURN_ULONG which implicitly converts?). > > Now, it’s not as fast as a native IS_ULONG type would be, but we could still do things like > properly support file sizes in the 2GB-4GB range on 32-bit, at least. :) > > What do you think? It looks to me like yet another can of worms (how do you deal with conversions, mixed operations, etc. it adds a lot of special cases) with little benefits. 32bit environments are dying species. There are ways to support LFS without that as well (while I doubt the effort is worth it). So if I'd to choose whether PHP should support unsigned integer, my gut feeling right now is no, it should not. Cheers, -- Pierre @pierrejoye | http://www.libgd.org

« previous php.internals (#80681) next »