Subject: Re: [PATCH v2 0/3] C99: declare bool experiment a success

From: Junio C Hamano <[email-masked]>
Date: Tue, 15 Jul 2025 15:09:09 -0700

"brian m. carlson" <[email-masked]> writes:

> This series looked good to me.  I especially like the fact that we've
> made it easier for me to figure out whether starts_with and friends are
> booleans (that is, true if it starts with the value) or our standard
> zero/negative-one (that is, false if it starts with the value).

Hmph, this is a tangent, I've never thought of it that way.

The "0 is success and negative is failure" is exactly about success
and failure.  We expect such a call to succeed most of the time and
failure is a note-worthy event.

Functions like starts_with() and friends, those that Lispers might
name with q suffix, are quite different.  A predicate is asking "is
it, or isn't it?" question and returning "false" from it does not
imply a failure in any way.

I wouldn't dream of making them return -1 for "failure", because
starts_with(buf.buf, "#") that finds buf.buf does not begin with "#"
is no way failing.

Anyway, we may start rewriting our old-fashioned idiom to normalize
a "true if non-zero" integers, i.e.

	return !!some_true_if_non_zero_integer_variable;

into 

	return (bool)some_true_if_non_zero_integer_variable;

perhaps ;-).