Sujet : Re: Interval Comparisons
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 07. Jun 2024, 04:53:41
Autres entêtes
Organisation : None to speak of
Message-ID : <87bk4dz9ve.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6 7 8 9
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Lawrence D'Oliveiro <
ldo@nz.invalid> writes:
On Fri, 7 Jun 2024 01:52:34 +0100, bart wrote:
The 'a=b' (that's equality)
>
Not in C it isn’t.
Of course not. You snipped the part where Bart very clearly said that
he was talking about his own scripting language. And we're talking
about a proposed new C feature, so I have no problem with references to
other languages.
And there's precedent in other languages (Python, as Bart already
pointed out) for `a == b < c` being equivalent to `a == b && b < c`,
but with b evaluated only once.
*If* C were to adopt chained comparisons, I would have no problem
with `a == b < c` being supported with the obvious meaning.
I dislike arbitrary restrictions. (Though the fact that == and
< have different precedences would have to be resolved somehow.)
In principle it could quietly change the behavior of existing code,
but it's likely that most such code was already wrong. I don't
advocate making such a change, and I don't think it's likely to
happen, I wouldn't object to it.
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */