home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / cplus / 11525 < prev    next >
Encoding:
Internet Message Format  |  1992-07-25  |  1.1 KB

  1. 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
  2. From: cok@sunshine.Kodak.COM (David Cok)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: ztc 3.0 bug Ternary operator & chars
  5. Message-ID: <1992Jul25.025746.13323@kodak.kodak.com>
  6. Date: 25 Jul 92 02:57:46 GMT
  7. Article-I.D.: kodak.1992Jul25.025746.13323
  8. References: <1992Jul21.070508.3913@news.uni-stuttgart.de> <1992Jul21.162222.9895@taumet.com>
  9. Sender: news@kodak.kodak.com
  10. Organization: Eastman Kodak Co., Rochester, NY
  11. Lines: 20
  12.  
  13. In article <1992Jul21.162222.9895@taumet.com> steve@taumet.com (Steve Clamage) writes:
  14. >It really is a bug.  The code in question looked like this:
  15. >
  16. >    cout << (expr) ? '1' : '2';
  17. >
  18. >
  19. >This means that "1" or "2" should be printed, not "49" or "50".
  20. >-- 
  21. >
  22. >Steve Clamage, TauMetric Corp, steve@taumet.com
  23. >Vice Chair, ANSI C++ Committee, X3J16
  24.  
  25. Watch it!  << binds more tightly than ?: so the above is parenthesized as
  26.  
  27.     (cout << (expr)) ? '1' : '2';
  28.  
  29. which isn't what you wanted.
  30.  
  31. David Cok
  32. cok@Kodak.COM
  33.