The angry programmer thread (24)

10 Name: #!/usr/bin/anon 2006-01-17 04:05 ID:WBWEvxEy

Because there's already a perfectly good way to find the terminator (&p[strlen(p)]) and because if strchr() didn't find the '\0', I could do things like

while (strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZ", *p) == NULL)
p++;

to move to the first character that's not an uppercase letter. Instead I have to do

while (*p != '\0' && strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZ", *p) == NULL)
p++;

Being able to use strchr() for determining if a character is a member of a set of characters would be far more useful than using strchr(s, '\0') as a synonym for &s[strlen(s)]. And yeah, I can still do it, but the extra pointless comparison is annoying, since this is the kind of thing I normally use strchr to do.

This thread has been closed. You cannot post in this thread any longer.