home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!spool.mu.edu!agate!dog.ee.lbl.gov!horse.ee.lbl.gov!torek
- From: torek@horse.ee.lbl.gov (Chris Torek)
- Newsgroups: comp.lang.c
- Subject: Re: Hows this for odd
- Date: 11 Nov 1992 12:23:47 GMT
- Organization: Lawrence Berkeley Laboratory, Berkeley
- Lines: 31
- Message-ID: <27368@dog.ee.lbl.gov>
- References: <1992Nov9.102217.23060@monu6.cc.monash.edu.au> <BxGq4z.8oA@portal.hq.videocart.com> <1992Nov10.144922.13252@leland.Stanford.EDU> <1992Nov11.061508.21780@sq.sq.com>
- Reply-To: torek@horse.ee.lbl.gov (Chris Torek)
- NNTP-Posting-Host: 128.3.112.15
-
- (I was hoping to stay out of this mess, but...)
-
- I *can* think of one good use for
-
- i == 0 ? TRUE : FALSE
-
- (instead of just `i == 0', or, for the terse among us, `!i'). In this
- one situation, however, I would probably spell `TRUE' and `FALSE'
- differently.
-
- The situation I have in mind is a C-language implementation of some
- other (non-C) language, where the other language *has* a boolean type
- with specific values for `true' and `false'. For instance, a Pascal
- system written in C might use something like:
-
- i == 0 ? V_TRUE : V_FALSE
-
- to get the value nodes (which presumably would have some kind of
- aggregate type, or be an index into a table) for the `true' and `false'
- values. These would be different nodes from, e.g., the integer
- constant `0' and the untyped pointer `nil' (which might be V_0 and
- V_NIL respectively).
-
- The situation is not always clear-cut, and blanket statements like
- `a definition for TRUE is always bad' are bound to be false sometimes.
-
- (For the most part, though, I do think `i == 0 ? TRUE : FALSE' is at
- best suspicious.)
- --
- In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 510 486 5427)
- Berkeley, CA Domain: torek@ee.lbl.gov
-