Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69474 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14318 invoked from network); 3 Oct 2013 07:55:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Oct 2013 07:55:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=mike.php.net@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=mike.php.net@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.43 as permitted sender) X-PHP-List-Original-Sender: mike.php.net@gmail.com X-Host-Fingerprint: 209.85.215.43 mail-la0-f43.google.com Received: from [209.85.215.43] ([209.85.215.43:37458] helo=mail-la0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 82/F0-09098-4F22D425 for ; Thu, 03 Oct 2013 03:55:33 -0400 Received: by mail-la0-f43.google.com with SMTP id ep20so1610754lab.16 for ; Thu, 03 Oct 2013 00:55:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=Pm4UMBxf3yDw3h44JQUy8cAElLUtc5ROST5al/DoNSc=; b=S00jjJqxDLe+Pebt9DeJ76QXmWJ1oj/fxXORa86Ju7I/n85nEXjFJQaj97UXOfal58 pGxTI0D6Q4ZKKLXfwxqFtPxyj1l3vjV0cE0QmnJznaMvGQjaoqE51LfO97/Zdhs4XCgf CW9JB9Eu2clMbH/1xJF0edOIqLF9OA8oZ4lOX1o4Bkf9N0U43dVGYTxEygsxdeBqPUy+ cbCEG8zhzfcygGLR6fXu5+Jm9qH/hl0UI6qU4z/kRgY2igKd0esuhGfZI1P0ezPYRuJD +UD+4Lne+g+JI6h0+2jfmtnfoLYXkW8K5SnRr16W81ChEV9k/lQ5Pd706SPrpuBlDC7S PImA== MIME-Version: 1.0 X-Received: by 10.112.42.68 with SMTP id m4mr5930632lbl.4.1380786929716; Thu, 03 Oct 2013 00:55:29 -0700 (PDT) Sender: mike.php.net@gmail.com Received: by 10.114.184.19 with HTTP; Thu, 3 Oct 2013 00:55:29 -0700 (PDT) In-Reply-To: References: Date: Thu, 3 Oct 2013 09:55:29 +0200 X-Google-Sender-Auth: oTYVWqvtMG86a0wBIBhv-wfHO4w Message-ID: To: Jakub Zelenka Cc: PHP internals list , andrey@php.net Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Streams constify API change in master leads to compilation warning for extensions From: mike@php.net (Michael Wallner) On 2 October 2013 20:41, Jakub Zelenka wrote: > Hi, > > I was wondering why stream API has been changed in this commit: > > https://github.com/php/php-src/commit/92d27ccb0574f901a107409a7fec92888fa2b82f > > Basically all char pointers have been constified. The thing is that this > commit leads to compilation warning for many extensions. > > In my case I use php_stream_locate_url_wrapper and want to compile my > extension (fann) without any warnings. Because this change is in master and > not in 5.5-, I will have to add some ifdefs and cast it for 5.6+. > > The thing is that php_stream_locate_url_wrapper and other stream fuctions > are often used for function parameters from zend_parse_parameters which are > just char *. Then the values have to be casted. > Your claim actually makes not much sense... if you've got chat* and you pass it to a function accepting "const char*" there should'nt be a warning at all. But I guess you actually declrared your variable "const char*" and get the warning from zpp? That is not necessary: void const_dummy(const char *data) { printf("got %s\n", data); } PHP_FUNCTION(dummy) { char *data; if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data)) { return; } const_dummy(data); } FFI: http://en.wikipedia.org/wiki/Const#Constant_function_parameters -- Regards, Mike