This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch to create builtin strncmp


On Wed, Mar 22, 2000 at 11:32:28AM -0500, Kaveh R. Ghazi wrote:
> 	This patch creates a new builtin strncmp.  It operates
> similarly to the strcmp builtin except that it also clamps on the
> third arg (which must be a constant.)

This isn't correct.  Yes strncmp clamps the search on the 
third argument, but it also stops at '\0'.  If you don't
absolutely know the lengths of both strings you can't do
this optimization.


r~

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]