On Sun, 24 May 1998, MCENANEY WILLIAM J wrote:
> Hi Friends,
>
> I'm back. What's that I hear, a groan? Grin. Since "nice" is a vague word,
> I don't know what is nice about "!strcmp()." But if we're talking about
> readability and aesthetic appeal, I would love to change C. Call me a nit-
> picker. But if I wanted to find out whether two strings were identical, I'd
> want to use an equal sign in my "if" statement.
>
> Say I need to keep using strcmp(). Then I might define constants to stand
> for values that strcmp() returns. I could write:
>
> if (strcmp(s1, s2) == SAME)
> puts ("They're the same.");
> else
> puts ("They differ.");
>
> I'm no expert in C, but I'm a perfectionist about readability. Though my
> idea me not please an expert C programmer, it tells my readers what I mean.
> What do you think?
>
> Best wishes,
> Bill
>
I think you should UTSL and see how strcmp functions. It is not merely a
"they <do|do not> equate" function, its primary purpose is for sorting
strings. Determining if two strings match is a side effect of this.
The Wildman
Gravity is a myth, the earth sucks.
Fight spam - http://www.cauce.org/