Re: unsigned integer
| From: | Marc Bennewitz | Date: | Tue, 22 Jul 2014 20:53:31 +0000 |
| Subject: | Re: unsigned integer | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-75896@lists.php.net to get a copy of this message | ||
I mean a new scalar type here
On 22.07.2014 22:33, Nikita Popov wrote:
> On Tue, Jul 22, 2014 at 9:55 PM, Marc Bennewitz <php@marc-bennewitz.de>
> wrote:
>
>> Hi all,
>>
>> I like to create an RFC to add an unsigned integer type for the
>> following purposes:
>>
>> - higher max value
>> - DBs already allow UNSIGNED INT/BIGINT which is a farce to work with
>> in PHP
>> - better support pack/unpack unsigned integers from/to PHP using the
>> un/pack functions
>> - simplified right shift of unsigned integers because PHP "safes" the
>> sign bit on signed integers which leads to bugs or overcomplicated code
>> if you need that bit for others than a sign
>> - if a parameter type-hint or similar functionality will be implemented
>> this type will be very useful, too. Else it will be also useful to make
>> sure you have no negative integer by simply converting to it.
>>
>> What do you think?
>> (Does it worth the expense for a RFC?)
>>
>
> Could you please further clarify what you mean by "type" here? If you mean
> an actual new type (like integers currently are), then I highly doubt this
> is feasible (implementationally).
>
> If you mean something like an UnsignedInt class with overloaded operators,
> that should be easy to implement. Not sure if we want it in core though.
>
> Nikita
>