Liste des Groupes | Revenir à cl c |
On 04/06/2024 09:14, Lawrence D'Oliveiro wrote:That does not prevet from doing the same with a different syntax.Would it break backward compatibility for C to add a feature like thisDo you mean, could C treat "a <= x <= b" as "(a <= x) && (x <= b)" without breaking existing code? The answer is no, C treats it as the expression "(a <= x) <= b". So you would be changing the meaning of existing C code. I think it's fair to say there is likely to be very little existing correct and working C code that relies on the current interpretation of such expressions, but the possibility is enough to rule out such a change ever happening in C. (And it would also complicate the grammar a fair bit.)
from Python? Namely, the ability to check if a value lies in an interval:
def valid_char(c) :
"is integer c the code for a valid Unicode character." \
" This excludes surrogates."
return \
(
0 <= c <= 0x10FFFF
and
not (0xD800 <= c < 0xE000)
)
#end valid_char
<https://c-faq.com/expr/transitivity.html>
Les messages affichés proviennent d'usenet.