Deutsch English Français Italiano |
<v3uoq3$21g4g$7@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Lawrence D'Oliveiro <ldo@nz.invalid> Newsgroups: comp.lang.c Subject: Shortcut Booleans Date: Fri, 7 Jun 2024 10:52:51 -0000 (UTC) Organization: A noiseless patient Spider Lines: 27 Message-ID: <v3uoq3$21g4g$7@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Fri, 07 Jun 2024 12:52:51 +0200 (CEST) Injection-Info: dont-email.me; posting-host="21a6995757d724b8d83dd14f044d030a"; logging-data="2146448"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+S/pbZlQmPTig9nyfypEtU" User-Agent: Pan/0.158 (Avdiivka; ) Cancel-Lock: sha1:Vu7lS40aB0Vwp80xYKUMu+98qsk= Bytes: 1468 I wonder why, traditionally, shortcut evaluation of boolean subexpressions has been applied to “and” and “or” connectives, but not any others. For example, what about “implies”? a implies b Truth table: a b result ------------ 0 0 1 0 1 1 1 0 0 1 1 1 But C does not have an “implies” operator, I hear you say? Of course this can be written not a or b and shortcut evaluation would apply. But it can also be written a <= b and shortcut evaluation would *not* apply. Why not, if a and b are boolean-valued subexpressions?