Re: [PHP4BETA] Re: [PHP-DEV] Should php3_fopen_for_parser change
| From: | Zeev Suraski | Date: | Fri, 26 Nov 1999 12:16:00 +0000 |
| Subject: | Re: [PHP4BETA] Re: [PHP-DEV] Should php3_fopen_for_parser change | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-6916@lists.php.net to get a copy of this message | ||
Remember not all platforms have the _r functions. We *must* use strtok()
if strtok_r() is not available; So, the #ifdef logic would have to be
applied anyway, and the way I see it, we might as well use the non thread
safe versions if we're not compiling for ZTS (even though I don't really
mind).
I don't think we can easily sort that issue out using header files, mainly
because _r functions usually require you to pass additional arguments
which vary from function to function. We can try to be creative though.
I know there's been a witch hunt against using #ifdef's in the last couple
of days, and I find it weird to stand in the opposite side since I hate
#ifdef infested code (look at the mailing list from a year ago :). But
sometimes that's the price you have to pay when you have something that
has to run on just about any platform and take advantage of the most
advanced features on each, and not the least common denominator.
Zeev
On Fri, 26 Nov 1999, Andi Gutmans wrote:
> At 08:33 AM 11/26/99 +0100, Thies C. Arntzen wrote:
> >On Thu, 25 Nov 1999, Rasmus Lerdorf wrote:
> >
> > > > Are there any publicly available header files which do the necessary
> > > > non-threadsafe -> threadsafe UNIX libc functions mapping. For example,
> > > > strtok -> strtok_r?
> > >
> > > Not that I know of. Would be nice, but I am afraid there is no such magic
> > > silver bullet. It would be an #ifdef nightmare too as this stuff varies
> > > wildly across platforms.
> >
> >there are only a few functions like this used in the "core" of the
> >language - strtok comes to mind.
> >
> >to replace them should not be hard at all. we should not go with the
> >#ifdef way of life, but just reimplemet those thing thread-safe.
>
> Why not create one header file with the necessary #ifdef's? I think if a
> thread safe strtok is available I'd like to use it.
>
> Andi
> ---
> Andi Gutmans <andi@zend.com>
> http://www.zend.com/
>
> --
> PHP 4.0 Beta Mailing List <http://www.php.net/version4/>
> To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net
> For additional commands, e-mail: php4beta-help@lists.php.net
> To contact the list administrators, e-mail: php4beta-admin@lists.php.net
>
--
-----------------------------------------------------
Zeev Suraski <zeev@zend.com> http://www.zend.com/