Shortcut Booleans

Liste des GroupesRevenir à cl c  
Sujet : Shortcut Booleans
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.c
Date : 07. Jun 2024, 12:52:51
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v3uoq3$21g4g$7@dont-email.me>
User-Agent : Pan/0.158 (Avdiivka; )
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?

Date Sujet#  Auteur
7 Jun 24 * Shortcut Booleans6Lawrence D'Oliveiro
7 Jun 24 `* Re: Shortcut Booleans5bart
8 Jun 24  `* Re: Shortcut Booleans4Lawrence D'Oliveiro
9 Jun 24   `* Re: Shortcut Booleans3David Brown
10 Jun 24    `* Re: Shortcut Booleans2Lawrence D'Oliveiro
10 Jun 24     `- Re: Shortcut Booleans1Keith Thompson

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal