home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!taumet!steve
- From: steve@taumet.com (Steve Clamage)
- Subject: Re: ztc 3.0 bug Ternary operator & chars
- Message-ID: <1992Jul21.162222.9895@taumet.com>
- Organization: TauMetric Corporation
- References: <1992Jul21.070508.3913@news.uni-stuttgart.de>
- Date: Tue, 21 Jul 1992 16:22:22 GMT
- Lines: 24
-
- LANG@129.69.123.1 (MARTIN LANG) writes:
-
- >This behavior is not a bug. The ternary operator evaluates arithmetic
- >expressions. Your character constants are handled as expressions and
- >typecasted. That is the standard. (see ARM page 78)
-
- It really is a bug. The code in question looked like this:
-
- cout << (expr) ? '1' : '2';
-
- The original printing of the ARM had the old C rule about promotion
- of the 2nd and 3rd expressions; this was an error. Check a later
- printing, which you can identify by "Reprinted with corrections"
- appearing near the bottom of the copyright page.
-
- Page 78, second paragraph, should say
-
- "... if they are of the same type the result is of that type; ..."
-
- 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
-