home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!news.funet.fi!hydra!klaava!wirzeniu
- From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
- Newsgroups: comp.lang.c
- Subject: Re: single formula for number of bits set in a byte
- Message-ID: <1992Nov7.215347.21360@klaava.Helsinki.FI>
- Date: 7 Nov 92 21:53:47 GMT
- References: <530@ulogic.UUCP> <6444@ucsbcsl.ucsb.edu> <566@ulogic.UUCP>
- Organization: University of Helsinki
- Lines: 18
-
- hartman@ulogic.UUCP (Richard M. Hartman) writes:
- >I have never met a compiler that yields other than 1 and 0 for
- >equality and relational expressions.
-
- Even K&R-1 said that the result of a boolean expression is either 0 or
- 1, even though any non-zero value in a boolean context stands for
- "true". IMHO, any compiler which gets this wrong is seriously broken.
-
- >For C++ compilers this is guaranteed in the ARM (p74, section 5.9).
- >Unfortunately I don't have the ANSI C compiler document available
- >but I would suspect this is guarenteed there also.
-
- It is. Don't have the standard itself, but "Standard C" by Plauger and
- Brodie describes this behaviour for every boolean operator.
-
- --
- Lars.Wirzenius@helsinki.fi (finger wirzeniu@klaava.helsinki.fi)
- MS-DOS, you can't live with it, you can live without it.
-