Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65561 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76320 invoked from network); 2 Feb 2013 14:06:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Feb 2013 14:06:33 -0000 Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.22 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.22 smtp2.ist.utl.pt Linux 2.6 Received: from [193.136.128.22] ([193.136.128.22:44325] helo=smtp2.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 38/D0-63259-76D1D015 for ; Sat, 02 Feb 2013 09:06:32 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.ist.utl.pt (Postfix) with ESMTP id 834CF70003ED; Sat, 2 Feb 2013 14:06:28 +0000 (WET) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp2.ist.utl.pt ([127.0.0.1]) by localhost (smtp2.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id qZyjMaC4RvOY; Sat, 2 Feb 2013 14:06:28 +0000 (WET) Received: from mail2.ist.utl.pt (mail.ist.utl.pt [IPv6:2001:690:2100:1::8]) by smtp2.ist.utl.pt (Postfix) with ESMTP id 4020970003DC; Sat, 2 Feb 2013 14:06:28 +0000 (WET) Received: from damnation.nl.lo.geleia.net (unknown [IPv6:2001:470:94a2:4:21d:baff:feee:cc0b]) (Authenticated sender: ist155741) by mail2.ist.utl.pt (Postfix) with ESMTPSA id 57644200749F; Sat, 2 Feb 2013 14:06:27 +0000 (WET) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "PHP internals" , "Sara Golemon" References: Date: Sat, 02 Feb 2013 15:06:22 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Organization: =?utf-8?Q?N=C3=BAcleo_de_Eng=2E_Biom=C3=A9di?= =?utf-8?Q?ca_do_I=2ES=2ET=2E?= Message-ID: In-Reply-To: User-Agent: Opera Mail/12.12 (Linux) Subject: Re: Non-pointer params, zend_parse_parameters, and the "!" modifier From: glopes@nebm.ist.utl.pt ("Gustavo Lopes") On Sat, 02 Feb 2013 14:36:00 +0100, Sara Golemon wrote: > Gustavo's diff for scalars adds '!' support (this was ignored > previously) by letting the NULL get cast to the type (e.g. > false/0/0.0) and using a second zend_bool parameter to indicate if > NULL was passed or not: > > long num = 42; > zend_bool num_was_null; > > if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l!", &num, > &num_was_null) == FAILURE) return; > > Now if the func is called with NULL as the argument, num will still be > overwritten to 0, but we'll get the flag indicating that NULL got > passed in, and we're forced to reset it to the default value (assuming > that was our intent). > > [...] >Thoughts? You raise a good point. From my part, feel free to modify it so the passed long is not changed. -- Gustavo Lopes