home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!ferkel.ucsb.edu!taco!gatech!darwin.sura.net!zaphod.mps.ohio-state.edu!cs.utexas.edu!csc.ti.com!tilde.csc.ti.com!mksol!mccall
- From: mccall@mksol.dseg.ti.com (fred j mccall 575-3539)
- Subject: Re: Hows this for odd
- Message-ID: <1992Nov10.161008.27590@mksol.dseg.ti.com>
- Organization: Texas Instruments Inc
- References: <1992Nov9.102217.23060@monu6.cc.monash.edu.au> <1992Nov9.231340.10201@ptcburp.ptcbu.oz.au>
- Date: Tue, 10 Nov 1992 16:10:08 GMT
- Lines: 36
-
- In <1992Nov9.231340.10201@ptcburp.ptcbu.oz.au> michi@ptcburp.ptcbu.oz.au (Michael Henning) writes:
-
- >bena@yoyo.cc.monash.edu.au (Ben Aveling) writes:
-
- >>Just recently I saw the following fragment of code, and I thought I'd share
- >>it with you all. (This is real code, part of a real program people will
- >>pay money for.)
-
- >> ... ,(i==0)?TRUE:FALSE,...
-
- >From the source code for a popular UNIX debugger:
-
- > if (strncmp(p, "", 1) != 0) {
- > ...
- > }
-
- >There are lots of gems like that around :-(
-
- Well, I generally do the explicit comparison on string comparisons,
- too, because I ran into at least one compiler that would fail to
- return the 'correct' answer if the result was negative (it would claim
- 'false', even though a non-zero ought to be true). Yes, this compiler
- was broken, but given the choice between working around where it was
- broken and having my code be broken, I chose the former.
-
- I'm afraid I find this other idiom ("(i==0)?TRUE:FALSE") to be just a
- bit peculiar, though. Someone else made the point that TRUE and FALSE
- might have been redefined to some 'program specific' values, but why
- write code that works against the language by defining your own
- 'special' TRUE and FALSE values?
-
- --
- "Insisting on perfect safety is for people who don't have the balls to live
- in the real world." -- Mary Shafer, NASA Ames Dryden
- ------------------------------------------------------------------------------
- Fred.McCall@dseg.ti.com - I don't speak for others and they don't speak for me.
-