Re: search.c clean-up



Jim Meyering <jim@xxxxxxxxxxxx> writes:

>> Note that some compiling environments might optimise away strlen
>> calls on constant strings, but only if they know at compile time
>> that they are going to be linked to a "strlen" that behaves like
>> the standard version of that function. That's a dangerous
>> assumption in some environments. The use of intermediate variables
>> can much more easily be optimised away.
>
> I see no problem with using strlen here.

I agree. The C Standard does not allow user programs to redefine
strlen. This is true even for programs that don't include <string.h>.
It's quite safe in practice to assume that strlen has the usual behavior.







Privacy