Article View: comp.std.c
Article #1304boolean
From: Karl Heuer
Date: Sat, 26 May 1990 22:16
Date: Sat, 26 May 1990 22:16
29 lines
2011 bytes
2011 bytes
In article <4232@castle.ed.ac.uk> aipdc@castle.ed.ac.uk (Paul D. Crowley) writes: >Peeve: why doesn't C have a type "boolean" built in? Answer relative to Classic C: K and R wanted to keep the language small, and decided that the more powerful% type "int" was sufficient. (In fact, there's evidence that at least one of them prefers to use an arithmetic type even in a language that already supports booleans.) Answer relative to ANSI C: because it wasn't within the charter of X3J11 to invent new features without a compelling reason. The idea was to standardize the language, not build a new one. Personal opinion: I'd have been satisfied with a typedef and two macro constants (or enums), hidden in either <stddef.h> or a separate header <bool.h>, with the compiler having the option of strictly enforcing the boolean-only use of this type. >I'm sure there's some compiler somewhere that could use it to >improve executables. There are some improvements that can be made (particularly in register allocation for functions that have more than one boolean variable with auto storage duration), but I think the more important improvement gain is in reducing programmer error by enforcing the restricted rules. Karl W. Z. Heuer (karl@ima.ima.isc.com or harvard!ima!karl), The Walking Lint ________ % int *is* more powerful than boolean, but this doesn't make it a better tool. (cf. the powerful flow control construct "goto".)
Technical Details
Message-ID:
<16734@haddock.ima.isc.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!think!snorkelwacker!spdcc!ima!haddock!karlReferences:
<5879@buengc.BU.EDU> <12971@smoke.BRL.MIL> <5897@buengc.BU.EDU> <12986@smoke.BRL.MIL> <5907@buengc.BU.EDU> <4232@castle.ed.ac.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!think!snorkelwacker!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.std.c Subject: boolean Message-ID: <16734@haddock.ima.isc.com> Date: 26 May 90 22:16:10 GMT References: <5879@buengc.BU.EDU> <12971@smoke.BRL.MIL> <5897@buengc.BU.EDU> <12986@smoke.BRL.MIL> <5907@buengc.BU.EDU> <4232@castle.ed.ac.uk> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 29