Re: Streams constify API change in master leads to compilation warning for extensions
| From: | William Bartlett | Date: | Thu, 03 Oct 2013 03:01:51 +0000 |
| Subject: | Re: Streams constify API change in master leads to compilation warning for extensions | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-69471@lists.php.net to get a copy of this message | ||
My understanding is that the const triggers some optimizations because the
compiler better understands how the variables are used.
I'm not sure what degree of a difference it makes, but I'm always a fan of
using const if it's appropriate.
Perhaps your effort is better spent modifying the extensions to not emit
warnings?
I would be concerned if there were compilation errors rather than warnings.
--
William Bartlett
College of Engineering | Cornell University '14
240-432-5189
On Wed, Oct 2, 2013 at 2:41 PM, Jakub Zelenka <bukka@php.net> 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.
>
> I understand that APIs should be improved and sometimes changes are
> necessary but in this case I have to ask a question. Was this change worthy
> to compilation warnings for many extensions?
>
> If not would it be possible to revert it?
>
> Thanks
>
> Jakub
>