Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67607 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18349 invoked from network); 2 Jun 2013 11:07:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Jun 2013 11:07:48 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.41 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.215.41 mail-la0-f41.google.com Received: from [209.85.215.41] ([209.85.215.41:60103] helo=mail-la0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 13/33-32744-2872BA15 for ; Sun, 02 Jun 2013 07:07:46 -0400 Received: by mail-la0-f41.google.com with SMTP id ee20so2614512lab.28 for ; Sun, 02 Jun 2013 04:07:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=D+5DRkfOU9FATDSZf1PdBCrncGUvGWdkenY9ut8g9h8=; b=vjr+iFtgg8dDkMeoo3A0tPZik9ysFR8YExsCMMJEgFfHsjeFW9ji63QIp1pQTP/pPD sv/riv8SWBAa/rkdQ7HyIlaLl0G6uB1HtTSJh290YznDzaZqPnNdm9S9bfSaLnNHXTdQ hd912bEQtVAhNMHZbaOkMtoVdVaApwxhvuOLFQKGFmDEltWAuAtFLMOASh9huMFtjTzw Z5bYNGDaeUU09Q3rWHY9JFHq8zZUdUBY2z4Lh1IabnHLZamDCRU48TJo6HYOx0r55SAC VqJNgZPPxoQYJhEE7wSRkVI0WgaN8+975nkRYnHQA1wDb8GxyJkouzjFUHUOeRcWijLd pKAA== MIME-Version: 1.0 X-Received: by 10.112.22.6 with SMTP id z6mr6540750lbe.43.1370171263211; Sun, 02 Jun 2013 04:07:43 -0700 (PDT) Received: by 10.112.138.135 with HTTP; Sun, 2 Jun 2013 04:07:43 -0700 (PDT) In-Reply-To: <5466EBBB-C74D-4498-9DBD-338F460694A5@schlueters.de> References: <5466EBBB-C74D-4498-9DBD-338F460694A5@schlueters.de> Date: Sun, 2 Jun 2013 13:07:43 +0200 Message-ID: To: =?ISO-8859-1?Q?Johannes_Schl=FCter?= Cc: Anthony Ferrara , "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] 5.NEXT Integer and String type modifications From: pierre.php@gmail.com (Pierre Joye) On Sun, Jun 2, 2013 at 11:11 AM, Johannes Schl=FCter wrote: > > > On Jun 2, 2013, at 8:34, Pierre Joye wrote: > >>> Obviously there's a pretty significant ABI break here. I propose a "twe= ak" >>> of the Z_* macros to "fix" that. Basically, Z_STRLEN() will cast the re= sult >>> to an int. This is the same behavior as today, and will mean that exist= ing >>> extensions continue to function exactly as today. But new extensions (a= nd >>> elsewhere in core) can use a new macro Z_STRSIZE() which will return th= e >>> native size_t. >> >> A new macro will be a good solution, but I would name it what it >> actually is, Z_SIZE_T. > > That's not what it is. It is the length of the string aka. var.value.str.= length as such it should indicate its relation to a string. So something li= ke Z_STRSIZE is correct (and the name is nice thinking about Unicode strin= gs where length (characters) !=3D size (bytes)) It is size_t. There is no such thing as unicode or multibyte string length in php but in mbstring, intl or iconv, to name a few. php strings are buffers, and buffers lengths use size_t. This macro (and other) are about extension developers, working in C, not about what its representation in userland. Even if they are closely related, obviously. The day we will have actual multi bytes/unicode strings, we will need a separate length to represent in characters (be multi bytes). Cheers, -- Pierre @pierrejoye | http://www.libgd.org