Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:28407 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5345 invoked by uid 1010); 19 Mar 2007 02:13:37 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 5329 invoked from network); 19 Mar 2007 02:13:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Mar 2007 02:13:37 -0000 Authentication-Results: pb1.pair.com header.from=gwynne@skytag.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=gwynne@skytag.com; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain skytag.com does not designate 208.97.132.145 as permitted sender) X-PHP-List-Original-Sender: gwynne@skytag.com X-Host-Fingerprint: 208.97.132.145 sd-green-bigip-145.dreamhost.com Linux 2.4/2.6 Received: from [208.97.132.145] ([208.97.132.145:42870] helo=spunkymail-a15.dreamhost.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1B/0A-18356-EC1FDF54 for ; Sun, 18 Mar 2007 21:13:36 -0500 Received: from [192.168.1.115] (c-66-31-87-198.hsd1.ma.comcast.net [66.31.87.198]) by spunkymail-a15.dreamhost.com (Postfix) with ESMTP id 022977F01E; Sun, 18 Mar 2007 19:13:31 -0700 (PDT) In-Reply-To: <4ACF3DC6-C41E-481D-9222-BE461D4E5061@omniti.com> References: <86478A67-DCA2-4000-9EF0-DA4338E8389B@omniti.com> <24F7763B-824F-42B9-B7DA-C831BCF37D04@omniti.com> <458C4061-9633-4D3A-BD25-5256A7CAF6B2@skytag.com> <4ACF3DC6-C41E-481D-9222-BE461D4E5061@omniti.com> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-ID: <5916E5BC-BF13-4723-A97A-AE6057B780A7@skytag.com> Cc: internals@lists.php.net Content-Transfer-Encoding: 7bit Date: Sun, 18 Mar 2007 22:13:28 -0400 To: Wez Furlong X-Mailer: Apple Mail (2.752.3) Subject: Re: [PHP-DEV] Re: PATCH: anonymous functions in PHP From: gwynne@skytag.com (Gwynne) On Mar 18, 2007, at 9:30 PM, Wez Furlong wrote: > Your nitpicking happens to be wrong ;-) > > sizeof("string constant") is the "same" as strlen("string constant") > +1, but is resolved at compile time, so we use sizeof("string > constant")-1 to get a compile time evaluated strlen(). This trick > is used throughout the PHP internals. Ah. I've never seen it used that way before; I apologize for my ignorance :). In my experience, sizeof() on a character constant would evaluate as sizeof( const char * const ). > On Mar 18, 2007, at 9:27 PM, Gwynne wrote: >>> Updated patch at http://pastebin.ca/400952 >>> Not 100% sure if my hack in zend_compile.c is righteous, but it >>> doesn't seem too far wrong. >> >> 74. + if (!memcmp(opline- >> >op2.u.constant.value.str.val, "__zend_anon_", sizeof >> ("__zend_anon_")-1)) { >> >> Pardon my nitpicking, but shouldn't this be: >> >> 74. + if (!memcmp(opline- >> >op2.u.constant.value.str.val, "__zend_anon_", strlen >> ("__zend_anon_")-1)) { >> >> Also, a strong +1 for this patch, I'd love to see this support in >> PHP. -- Gwynne, Daughter of the Code "This whole world is an asylum for the incurable."