home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / aix / 13636 < prev    next >
Encoding:
Internet Message Format  |  1993-01-22  |  2.7 KB

  1. Path: sparky!uunet!franvm3.VNET.IBM.COM
  2. From: kraemerf@franvm3.VNET.IBM.COM (Frank Kraemer)
  3. Message-ID: <19930122.052714.669@almaden.ibm.com>
  4. Date: Fri, 22 Jan 93 14:25:03 CET
  5. Newsgroups: comp.unix.aix
  6. Subject: xlC++ Severe Compiler Error
  7. Reply-To: kraemerf@franvm3.VNET.IBM.COM
  8. Organization: IBM Germany, BO-89 ACIS South
  9. Disclaimer: This posting represents the poster's views, not those of IBM
  10. News-Software: Usenet 3.0
  11. Lines: 80
  12.  
  13. .
  14.  
  15. One of my customers (University of Kassel) send me the following
  16. small C++ program and complained that the xlC++ compiler does
  17. not work as it should be. He is running on AIX 3.2.3 level.
  18.  
  19. Yes, I'm the proud owner of a C++ book, bought at Palo Alto
  20. in march 1991 - it's a nice looking book but I never touched
  21. more than the table of contents with my eyes, but my friends
  22. are very impressed.........
  23.  
  24. So the question to the audience is, is this real good C++ style or
  25. is our comipler buggy.......
  26.  
  27.  
  28. > ////////////////////////////////////////////////////
  29. >
  30. > #include <iostream.h>
  31. > void main()
  32. > {
  33. >   double a, b, c, d, e, f, g, h;
  34. >   a = 0.0;
  35. >   b = 0.5;
  36. >   c = 1.0;
  37. >   d = 1.5;
  38. >   e = 1.0/2.0;
  39. >   f = +0.5;
  40. >   g = 5e-1;
  41. >   h = 1/2;      // this is no mistake, just a well known
  42. >                 // C trick for testing purposes
  43. >
  44. >   cout << "Variations for 1/2 (in C++):\n\n";
  45. >
  46. >   cout << " a = " << a << " should be 0.0 \n";
  47. >   cout << " b = " << b << " should be 0.5 \n";
  48. >   cout << " c = " << c << " should be 1.0 \n";
  49. >   cout << " d = " << d << " should be 1.5 \n";
  50. >   cout << " e = " << e << " should be 0.5 \n";
  51. >   cout << " f = " << f << " should be 0.5 \n";
  52. >   cout << " g = " << g << " should be 0.5 \n";
  53. >   cout << " h = " << h << " should be 0.0 (!)\n";
  54. >
  55. > } // main
  56. >
  57. > ////////////////////////////////////////////////////////
  58. >
  59. > That's the output:
  60. >
  61. > Variations for 1/2 (in C++):
  62. >
  63. >  a = 0 should be 0.0
  64. >  b = 0 should be 0.5
  65. >  c = 1 should be 1.0
  66. >  d = 1 should be 1.5
  67. >  e = 0.5 shoulbe d 0.5
  68. >  f = 0 should be 0.5
  69. >  g = 0.5 shoulbe d 0.5
  70. >  h = 0 should be 0.0 (!)
  71. >
  72. > ////////////////////////////////////////////////////////
  73.  
  74. thanks for your comments
  75.  
  76. -frank-
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85. .----------------------------------------------------------------------.
  86. | E-Mail: FRANVM3(KRAEMERF)                 - IBM VNET  "Yes, I'm one  |
  87. | ======  IBMMAIL(DEIBM27S)                 - IBM-Mail   of those      |
  88. |         DE.IBMX400.IBMMAIL.KRAEMER.KRAEME - X.400      stupid IBM    |
  89. |         kraemerf@franvm3.vnet.ibm.com     - Internet   field SE's."  |
  90. | Voice : +49-(0)611/776-364                                           |
  91. | Mail  : Abraham-Lincoln Street 26, 6200 Wiesbaden, Germany           |
  92. '----------------------------------------------------------------------'
  93.