On Tue, Jun 21, 2016 at 08:22:41AM +0200, Edward Bartolo wrote: [cut]
> > I studied 'and' and 'or' boolean operators back when I studied Delphi > Pascal. I am embarrassed to have written such a stupid thing. It must > be due to the fact I wrote the email just before going to bed. > > AND: requires ALL sub-expressions to be true to evaluate to true > i.e. Q = A ^ B ^ C ^ .... D > Q = 1 if and only if A = B = C = .... D = 1 > > OR: only requires ONE sub-exression to be true to evaluate to true > i.e. Q = A v B v C v .... D > Q = 1 if any Ai = 1 > > These properties are used by compilers to optimize on boolean > expression evaluation. If I remember well, there are also specific Be careful, because conditional expressions in C are subject to "short-circuiting", meaning that only the minimum number of expressions sufficient to determine the value of a chain of && and || will be evaluated. In particular, a chain of || expressions will be evaluated until there is one that evaluates to TRUE (!=0), while a chain of && is evaluated until there is one of them which evaluates to false (==0). HND KatolaZ -- [ ~.,_ Enzo Nicosia aka KatolaZ - GLUGCT -- Freaknet Medialab ] [ "+. katolaz [at] freaknet.org --- katolaz [at] yahoo.it ] [ @) http://kalos.mine.nu --- Devuan GNU + Linux User ] [ @@) http://maths.qmul.ac.uk/~vnicosia -- GPG: 0B5F062F ] [ (@@@) Twitter: @KatolaZ - skype: katolaz -- github: KatolaZ ] _______________________________________________ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng