Re: [PATCH] array_combine is not binary-key safe

From: Date: Mon, 24 Jul 2006 07:50:34 +0000
Subject: Re: [PATCH] array_combine is not binary-key safe
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-24919@lists.php.net to get a copy of this message
Either way, is it worth committing the patch ? 1 - For the non-optimizing compilers. 2 - Consistency across all source - static string use sizeof() rather than strlen() +1 If so, I'll need to amend the patch to NOT use +1, though judging by the comments made by bertrand Gugger, maybe something needs to be revisited. On 23/07/06, Ilia Alshanetsky <ilia@prohost.org> wrote:
Most compiler (I know gcc and Visual C do) will optimize strlen("static_string"). On 21-Jul-06, at 9:04 AM, Matt W wrote: Hi Richard, I think I've seen those instances that you're referring to. By fixed length string I assume you mean hard-coded "string_key". Yeah, I would think those should use add_assoc_*_ex() since the length is known (sizeof("string_key") etc.) to save unnecessary strlen() calls. Unless compilers optimize the strlen("string_key") + 1 to a constant from the add_assoc_*() macro. But I wouldn't think that's the case...? :-/ Matt -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&amp;r=213474731 "Standing on the shoulders of some very clever giants!"


« previous php.internals (#24919) next »