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 <[EMAIL PROTECTED]> 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&r=213474731 "Standing on the shoulders of some very clever giants!" -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php