Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail NNTP-Posting-Date: Sun, 25 Mar 2012 05:43:36 -0500 From: Gareth Owen Newsgroups: comp.lang.c Subject: Re: c99 and the lack of warnings when int operations are applied to a bool References: <2btpm7tmttqo12hmj37jhj0db4vobf07i9@4ax.com> <9t4ctfF3fiU2@mid.individual.net> Date: Sun, 25 Mar 2012 11:44:01 +0100 Message-ID: <87r4whklji.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:L2DnGRzt49ErPwFFDy/8IruDuwQ= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Lines: 21 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-aSY2r9jxTQGsiVxcQK/+Crns0zkl/t/71OtgkGFFTTmMXDv41wVd0qu5IFn/870UshkSnmahnpuGsnb!+FKVu4Fa8OZJYnTR1EPoZ2lweZUvNc/RnKcu2BWSMXKnUIdq6muSzYDf0bdvuThoubqnEw== X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 1866 Xref: csiph.com comp.lang.c:19024 Willem writes: > No, at least addition and multiplication are commonplace for boolean > algebra in mathematics. Yes, but does the mathematical definition fit the 'C' one? If we think of boolean's as lying in Z_2 (i.e. integers mod 2) we have 1+1 (mod 2) = 2(mod 2) = 0. With 'C' we have true + true => 1 + 1 => 2 => true. C boolean arithmetic is not Z_2 arithmetic. There's no point appealing to the commonplace in mathematics, if applying that mathematical logic in C programs will result in incorrect answers. And if we want boolean logic operators, we've already got them in ~, &, | and ^