Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_2) / zend.h zend_API.c zend_builtin_functions.c zend_compile.c zend_execute_API.c zend_object_handlers.c /tests bug43128.phpt php-src NEWS

[email protected] (Dmitry Stogov)
Newsgroups php.zend-engine.cvs
Message-ID <[email protected]>

Marcus Boerger wrote:
> Hello Stanislav,
> 
>   well in this case as well as in most other cases we deal with unrestricted
> lengths. So adding an additional complexity does not seem very good imo.
> Also we agreed on alloca when there is no function call befween alloca and
> its free_alloca.

How function between alloca() and free_alooca() (that actually NOP) may 
break something?

 From my experience it's may be dangerous to use alloca() in the loop,
because stack grows on each iteration and never came back before return.
(I have removed such alloca() usage in the patch).

> Btw, from the manpage:
> The  alloca()  function is machine and compiler dependent. On many sys-
> tems its implementation is buggy. Its use is discouraged.
> [...]

Especially for this reason we use do_alloca() macros that uses emalloc() 
on such systems.

Thanks. Dmitry.

> 
> 
> 
> marcus
> 
> Friday, February 15, 2008, 10:14:52 PM, you wrote:
> 
>>>   intersting change on the Zend side of PHP then. I remember that you guys
>>> were pretty much against any use of alloca. But well as long as you do it...
> 
>> I don't remember being against any use of alloca()... IMHO alloca() is 
>> OK as long as it is used for short things that live very short time 
>> (like temp strings).
> 
> 
> 
> Best regards,
>  Marcus
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.