The angry programmer thread (24)

11 Name: #!/usr/bin/anon 2006-01-17 05:31 ID:OU5K9G1R

>>10
Eh, strchr(foo, '\0') does exactly what it advertises. Complaining about the extra work of making a comparison is kind of silly when you're using C to begin with.

13 Name: dmpk2k!hinhT6kz2E 2006-01-17 06:56 ID:Heaven

>>10
Well, thing is, not all arrays are null terminated. Once you recognize that, strchr()s behaviour is no longer all that surprising. Admittedly, using strchr() on such an array can be dangerous if you're not careful.

I think a more legitimate complaint is that we have null-terminated strings in C at all. It'd be nice if they updated C's standard libraries to reflect the times...

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