Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75896 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2848 invoked from network); 22 Jul 2014 20:53:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Jul 2014 20:53:38 -0000 Authentication-Results: pb1.pair.com header.from=php@mabe.berlin; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@mabe.berlin; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mabe.berlin from 80.237.132.171 cause and error) X-PHP-List-Original-Sender: php@mabe.berlin X-Host-Fingerprint: 80.237.132.171 wp164.webpack.hosteurope.de Received: from [80.237.132.171] ([80.237.132.171:58919] helo=wp164.webpack.hosteurope.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 44/54-21666-05FCEC35 for ; Tue, 22 Jul 2014 16:53:37 -0400 Received: from dslb-178-005-231-020.178.005.pools.vodafone-ip.de ([178.5.231.20] helo=[192.168.178.30]); authenticated by wp164.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) id 1X9h41-00085j-R9; Tue, 22 Jul 2014 22:53:33 +0200 Message-ID: <53CECF4B.9050507@mabe.berlin> Date: Tue, 22 Jul 2014 22:53:31 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: internals@lists.php.net References: <53CEC194.5090307@marc-bennewitz.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-bounce-key: webpack.hosteurope.de;php@mabe.berlin;1406062417;6e2ea7c4; Subject: Re: [PHP-DEV] unsigned integer From: php@mabe.berlin (Marc Bennewitz) 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 > 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 >