Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65562 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77763 invoked from network); 2 Feb 2013 14:11:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Feb 2013 14:11:44 -0000 Authentication-Results: pb1.pair.com header.from=felipensp@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=felipensp@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.170 as permitted sender) X-PHP-List-Original-Sender: felipensp@gmail.com X-Host-Fingerprint: 209.85.217.170 mail-lb0-f170.google.com Received: from [209.85.217.170] ([209.85.217.170:46952] helo=mail-lb0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9A/21-63259-E9E1D015 for ; Sat, 02 Feb 2013 09:11:43 -0500 Received: by mail-lb0-f170.google.com with SMTP id ge1so5450021lbb.29 for ; Sat, 02 Feb 2013 06:11:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=megNHCQixyZGupwjjBEyZyCPyDTybklMGz2ZX/McnPo=; b=DEKdG9kVQiQWtks4j+heuN6ZND6ZuFiRgmdCbR+xXdSnnln1+rtJ8RNIJW5owHmjQ5 UByq0It2QCQK1HbMHVqmkWAfaNfNbUP7yS4W/1gdNkpBamu2ajQNiEt10k5SxV7AIt5/ YFmbPdccMZpYMw1oYvQ0CCaT8PAKNXHu9CVwuHNFRNM//unZ9YzKHiHM0Cka1a2uAR/B YHo7hNkseGBnxFJHGVkdqh6k80kwevhy/bGvEcOwpQh2BDnfs1pd8Qk2GJBrqsiKA4w8 XnLuuV3uTyszmD1jrgKIjDSxUJTjxLmuiw68qRRvvDRcnhh8aFqcK6mWIXTo3/99ag81 4cGw== X-Received: by 10.112.28.65 with SMTP id z1mr5962911lbg.119.1359814299604; Sat, 02 Feb 2013 06:11:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.112.8.2 with HTTP; Sat, 2 Feb 2013 06:11:19 -0800 (PST) In-Reply-To: References: Date: Sat, 2 Feb 2013 12:11:19 -0200 Message-ID: To: Gustavo Lopes Cc: PHP internals , Sara Golemon Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Re: Non-pointer params, zend_parse_parameters, and the "!" modifier From: felipensp@gmail.com (Felipe Pena) 2013/2/2 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. > Yeah, makes sense. +1 -- Regards, Felipe Pena