home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!hp-cv!ogicse!das-news.harvard.edu!spdcc!dirtydog.ima.isc.com!newsserver.pixel.kodak.com!kodak!sunshine!cok
- From: cok@sunshine.Kodak.COM (David Cok)
- Newsgroups: comp.lang.c++
- Subject: Re: ztc 3.0 bug Ternary operator & chars
- Message-ID: <1992Jul25.025746.13323@kodak.kodak.com>
- Date: 25 Jul 92 02:57:46 GMT
- Article-I.D.: kodak.1992Jul25.025746.13323
- References: <1992Jul21.070508.3913@news.uni-stuttgart.de> <1992Jul21.162222.9895@taumet.com>
- Sender: news@kodak.kodak.com
- Organization: Eastman Kodak Co., Rochester, NY
- Lines: 20
-
- In article <1992Jul21.162222.9895@taumet.com> steve@taumet.com (Steve Clamage) writes:
- >It really is a bug. The code in question looked like this:
- >
- > cout << (expr) ? '1' : '2';
- >
- >
- >This means that "1" or "2" should be printed, not "49" or "50".
- >--
- >
- >Steve Clamage, TauMetric Corp, steve@taumet.com
- >Vice Chair, ANSI C++ Committee, X3J16
-
- Watch it! << binds more tightly than ?: so the above is parenthesized as
-
- (cout << (expr)) ? '1' : '2';
-
- which isn't what you wanted.
-
- David Cok
- cok@Kodak.COM
-