Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63948 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59352 invoked from network); 17 Nov 2012 15:15:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Nov 2012 15:15:27 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; 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: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.217.170 mail-lb0-f170.google.com Received: from [209.85.217.170] ([209.85.217.170:63413] helo=mail-lb0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 36/76-08060-D0AA7A05 for ; Sat, 17 Nov 2012 10:15:26 -0500 Received: by mail-lb0-f170.google.com with SMTP id j14so2938710lbo.29 for ; Sat, 17 Nov 2012 07:15:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=Vz+DZfDsXY+3EbVxvEi8H5TFAuh6eEqLkzU6kGDlZ/o=; b=j0zjtBLmv5/Wv+8P4j0IIBSKwule/RsfhnqoS+VrEzz5gA9Qd8B1jBtlLYfiy+U/5b /F3CDTNNWJfydjUBZ7R7ChjRj1wOE+vfrNsJmm0Cukx9sewkMBnLAg8I0JmsYjJRSxOu 3NMIJybxJadfLjnOu15A6Ob9xGRlRlGxBMuGzLi2tFCzJ3BwPChhPk7LLiRIuO6v+59J yz7uuh1nTcSafZqIWbJaMPj4awZ7qAdwEKFrbYzOZXA9v3PmyAaSrxB5Y5yWrHhL2CAu mYG+iYKzRLCGmg85jxhrXWBZ2gAuQ/kYXrE6Y/6XWmCaYUm8SBBREwVxVNmGXMHm4jeW IjTg== MIME-Version: 1.0 Received: by 10.152.162.1 with SMTP id xw1mr7245887lab.3.1353165322831; Sat, 17 Nov 2012 07:15:22 -0800 (PST) Received: by 10.112.83.100 with HTTP; Sat, 17 Nov 2012 07:15:22 -0800 (PST) Date: Sat, 17 Nov 2012 16:15:22 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary=f46d042ef4a563c70504ceb25a36 Subject: Functions for getting long / double from zval with casts From: nikita.ppv@gmail.com (Nikita Popov) --f46d042ef4a563c70504ceb25a36 Content-Type: text/plain; charset=ISO-8859-1 Hi internals! It happens quite often that you need to extract an integer from a zval and you also want it to work for integers in strings, etc. In order to do so you currently have to cast the zval to integer. This is always rather complicated because you often don't want to actually change the passed zval. So you end up allocating / separating zvals and stuff like that. And I'm always confused just which exactly of the 50 different ways to cast a zval one should use in a particular situation. What I'd like to propose is a set of two new functions, which castingly get an integer or a float from a zval. The functions could look like this: long zval_get_long_with_cast(zval *value) double zval_get_double_with_cast(zval *value) What do you think? Nikita --f46d042ef4a563c70504ceb25a36--