Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:24919 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67822 invoked by uid 1010); 24 Jul 2006 07:50:39 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 67806 invoked from network); 24 Jul 2006 07:50:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jul 2006 07:50:39 -0000 Authentication-Results: pb1.pair.com header.from=rquadling@googlemail.com; domainkeys=good DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rquadling@googlemail.com X-Host-Fingerprint: 64.233.166.176 py-out-1112.google.com Linux 2.4/2.6 Received: from ([64.233.166.176:48432] helo=py-out-1112.google.com) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id 78/85-04178-CCB74C44 for ; Mon, 24 Jul 2006 03:50:37 -0400 Received: by py-out-1112.google.com with SMTP id x31so1046665pye for ; Mon, 24 Jul 2006 00:50:34 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=googlemail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=UiJX/4z4yxcw/tE63lwnBN3WBUbghgGBzIPJEynrv15s27GO/c4Jlw2OkNxSrGOcPMnvHMrucluzGNbU3dAZKNzY8JHiUiaZQNIgM76Rv0087aiZFDv++DvuwiKkipsA6RCyK2YKAolztiZE2t1ecM+Iy6ik/we+Jf1qGZQeNtc= Received: by 10.35.63.2 with SMTP id q2mr7100087pyk; Mon, 24 Jul 2006 00:50:34 -0700 (PDT) Received: by 10.35.93.18 with HTTP; Mon, 24 Jul 2006 00:50:34 -0700 (PDT) Message-ID: <10845a340607240050j673fc36dgfd74c7dc19fcf0b6@mail.gmail.com> Date: Mon, 24 Jul 2006 08:50:34 +0100 Reply-To: RQuadling@GoogleMail.com To: "Ilia Alshanetsky" Cc: "Matt W" , internals@lists.php.net In-Reply-To: <8EABC9D5-143B-4FA9-9CB0-14375E6B8193@prohost.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <014e01c6acbe$680b1bc0$0201a8c0@pc1> <10845a340607210543lfe173abq2221a1c833c5d9e1@mail.gmail.com> <017701c6acc6$3a526be0$0201a8c0@pc1> <8EABC9D5-143B-4FA9-9CB0-14375E6B8193@prohost.org> Subject: Re: [PHP-DEV] [PATCH] array_combine is not binary-key safe From: rquadling@googlemail.com ("Richard Quadling") Either way, is it worth committing the patch ? 1 - For the non-optimizing compilers. 2 - Consistency across all source - static string use sizeof() rather than strlen() +1 If so, I'll need to amend the patch to NOT use +1, though judging by the comments made by bertrand Gugger, maybe something needs to be revisited. On 23/07/06, Ilia Alshanetsky wrote: > > Most compiler (I know gcc and Visual C do) will optimize > strlen("static_string"). > > > > On 21-Jul-06, at 9:04 AM, Matt W wrote: > > > Hi Richard, > > I think I've seen those instances that you're referring to. By fixed length > string I assume you mean hard-coded "string_key". Yeah, I would think those > should use add_assoc_*_ex() since the length is known (sizeof("string_key") > etc.) to save unnecessary strlen() calls. > > Unless compilers optimize the strlen("string_key") + 1 to a constant from > the add_assoc_*() macro. But I wouldn't think that's the case...? :-/ > > > Matt -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!"