Subject: Re: lib/1764: __ivaliduser() contains call to abort()
To: John Kohl <firstname.lastname@example.org>
From: Greg Hudson <email@example.com>
Date: 11/16/1995 11:49:35
> I don't have a C standard handy, but it's been suggested to me in
> private mail that a compiler could choose to use -1 as the value of
> an equality boolean value.
>From ANSI X3.159-1989 section 3.3.8:
Each of the operators < (less than), > (greater than), <=
(less than or equal to), and >= (greater than or equal to)
shall yield 1 if the specified relation is true and 0 if it is
false. The result has type int.
Those semantics also apply to equality operators, although the
equality operators are specified separately because they have lower
> If it were to do so (or even if it chooses any non-1 value for
> TRUE), then rcmd.c will fail to do what it's intended to do because
> it currently negates the value of a boolean test and compares it
> with -1.
There is a stylistic error here; storing boolean values is fine, but
they should then only be used as boolean values. I don't particularly
like your answer (the "? 1 : 0" approach), but I haven't looked at the
code carefully enough to come up with a better one.