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: C++ PATCH: strcmp and strncmp usage cleanup (Re: C++ PATCH to fix thinko)


On Sat, May 20, 2000 at 10:28:17PM +0200, Gabriel Dos Reis wrote:
> It originated
> from the observation that using hard constants in strncmp is
> error-prone (and I should confess I agree).

I also agree, but notice the the problem is unsolved, really.

Perhaps something more along the line of 

#define skip_leading_substring(whole,part) \
  (strncmp(whole,part,strlen(part)) ? NULL : whole + strlen(part))

  if ((p2 = skip_leading_substring(p, "-fwhizzle-")) != NULL)
    process_whizzle(p2);

would be appropriate.



r~

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