Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32359 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95633 invoked by uid 1010); 17 Sep 2007 13:46:02 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 95616 invoked from network); 17 Sep 2007 13:46:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Sep 2007 13:46:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=nlopess@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=nlopess@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 212.55.154.22 as permitted sender) X-PHP-List-Original-Sender: nlopess@php.net X-Host-Fingerprint: 212.55.154.22 relay2.ptmail.sapo.pt Linux 2.4/2.6 Received: from [212.55.154.22] ([212.55.154.22:38064] helo=sapo.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1C/52-13443-2E48EE64 for ; Mon, 17 Sep 2007 09:45:58 -0400 Received: (qmail 5904 invoked from network); 17 Sep 2007 13:45:02 -0000 Received: from unknown (HELO sapo.pt) (10.134.35.208) by relay2 with SMTP; 17 Sep 2007 13:45:02 -0000 Received: (qmail 18664 invoked from network); 17 Sep 2007 13:44:59 -0000 X-AntiVirus: PTMail-AV 0.3-0.91.1 X-Virus-Status: Clean (0.00993 seconds) Received: from unknown (HELO pc07653) (nunoplopes@sapo.pt@[82.155.78.179]) (envelope-sender ) by mta13 (qmail-ldap-1.03) with SMTP for ; 17 Sep 2007 13:44:59 -0000 Message-ID: <001801c7f930$f4160a20$4001a8c0@pc07653> To: "Andrew Brampton" , References: <001f01c7f6f0$dbcf5350$4001a8c0@pc07653> <00e001c7f925$4dd85d80$0a00a8c0@Andrew> Date: Mon, 17 Sep 2007 14:45:04 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="Windows-1252"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 Subject: Re: [PHP-DEV] RFC: mark functions as const for possible optimizations From: nlopess@php.net ("Nuno Lopes") > I had a quick question about this. When would strlen('abcd') be execuated? > Say I had the code: > > $a = false; // This set by external input > if ( $a ) > $b = strlen('abcd'); > > Would the optimizer work out the length before the program starts to run? > Or would the optimizer wait until it knows the strlen is going to be > called then convert it to the constant 4? That's not my problem.. My RFC is about making the information available, not writing the optimizer itself (at least for now). With a naive optimizer, strlen() would be called, yes. > I could see the optimizer "constifying" many function calls which will > never get called. that's not a problem since you would use a cache.. Nuno