strcat+strcat+strcat == baaad

Shachar Shemesh wine-devel at sun.consumer.org.il
Sun Dec 1 06:57:52 CST 2002


Alexandre Julliard wrote:

>Francois Gouget <fgouget at free.fr> writes:
>  
>
>Well, no, the cost is linear. It would only be quadratic if the number
>of strcat calls depended on the length of the string.
>  
>
Well - still snprintf is more efficient.

>  
>
>>It's more efficient to do:
>>
>>  sprintf(foo, "%s%s%s%s%s%s", bar1,bar2,bar3,bar4,bar5,bar6);
>>    
>>
>
>I seriously doubt that sprintf would be faster that a couple of
>strcats. And I don't think we need to worry about this kind of
>micro-optimizations right now...
>  
>
But there is also no reason not to welcome these submissions if someone 
already took the time to submit them.

                Shachar





More information about the wine-devel mailing list