home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!franvm3.VNET.IBM.COM
- From: kraemerf@franvm3.VNET.IBM.COM (Frank Kraemer)
- Message-ID: <19930122.052714.669@almaden.ibm.com>
- Date: Fri, 22 Jan 93 14:25:03 CET
- Newsgroups: comp.unix.aix
- Subject: xlC++ Severe Compiler Error
- Reply-To: kraemerf@franvm3.VNET.IBM.COM
- Organization: IBM Germany, BO-89 ACIS South
- Disclaimer: This posting represents the poster's views, not those of IBM
- News-Software: Usenet 3.0
- Lines: 80
-
- .
-
- One of my customers (University of Kassel) send me the following
- small C++ program and complained that the xlC++ compiler does
- not work as it should be. He is running on AIX 3.2.3 level.
-
- Yes, I'm the proud owner of a C++ book, bought at Palo Alto
- in march 1991 - it's a nice looking book but I never touched
- more than the table of contents with my eyes, but my friends
- are very impressed.........
-
- So the question to the audience is, is this real good C++ style or
- is our comipler buggy.......
-
-
- > ////////////////////////////////////////////////////
- >
- > #include <iostream.h>
- > void main()
- > {
- > double a, b, c, d, e, f, g, h;
- > a = 0.0;
- > b = 0.5;
- > c = 1.0;
- > d = 1.5;
- > e = 1.0/2.0;
- > f = +0.5;
- > g = 5e-1;
- > h = 1/2; // this is no mistake, just a well known
- > // C trick for testing purposes
- >
- > cout << "Variations for 1/2 (in C++):\n\n";
- >
- > cout << " a = " << a << " should be 0.0 \n";
- > cout << " b = " << b << " should be 0.5 \n";
- > cout << " c = " << c << " should be 1.0 \n";
- > cout << " d = " << d << " should be 1.5 \n";
- > cout << " e = " << e << " should be 0.5 \n";
- > cout << " f = " << f << " should be 0.5 \n";
- > cout << " g = " << g << " should be 0.5 \n";
- > cout << " h = " << h << " should be 0.0 (!)\n";
- >
- > } // main
- >
- > ////////////////////////////////////////////////////////
- >
- > That's the output:
- >
- > Variations for 1/2 (in C++):
- >
- > a = 0 should be 0.0
- > b = 0 should be 0.5
- > c = 1 should be 1.0
- > d = 1 should be 1.5
- > e = 0.5 shoulbe d 0.5
- > f = 0 should be 0.5
- > g = 0.5 shoulbe d 0.5
- > h = 0 should be 0.0 (!)
- >
- > ////////////////////////////////////////////////////////
-
- thanks for your comments
-
- -frank-
-
-
-
-
-
-
-
-
- .----------------------------------------------------------------------.
- | E-Mail: FRANVM3(KRAEMERF) - IBM VNET "Yes, I'm one |
- | ====== IBMMAIL(DEIBM27S) - IBM-Mail of those |
- | DE.IBMX400.IBMMAIL.KRAEMER.KRAEME - X.400 stupid IBM |
- | kraemerf@franvm3.vnet.ibm.com - Internet field SE's." |
- | Voice : +49-(0)611/776-364 |
- | Mail : Abraham-Lincoln Street 26, 6200 Wiesbaden, Germany |
- '----------------------------------------------------------------------'
-