home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / aix / 13700 < prev    next >
Encoding:
Text File  |  1993-01-25  |  3.3 KB  |  112 lines

  1. Newsgroups: comp.unix.aix
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!merrick
  3. From: merrick@magnus.acs.ohio-state.edu (Tom Merrick)
  4. Subject: Re: xlC++ Severe Compiler Error
  5. Message-ID: <1993Jan25.130222.3387@magnus.acs.ohio-state.edu>
  6. Sender: news@magnus.acs.ohio-state.edu
  7. Nntp-Posting-Host: bottom.magnus.acs.ohio-state.edu
  8. Organization: The Ohio State University
  9. References: <19930122.052714.669@almaden.ibm.com>
  10. Date: Mon, 25 Jan 1993 13:02:22 GMT
  11. Lines: 99
  12.  
  13. In article <19930122.052714.669@almaden.ibm.com> kraemerf@franvm3.VNET.IBM.COM writes:
  14. >.
  15. >
  16. >One of my customers (University of Kassel) send me the following
  17. >small C++ program and complained that the xlC++ compiler does
  18. >not work as it should be. He is running on AIX 3.2.3 level.
  19. >
  20. >Yes, I'm the proud owner of a C++ book, bought at Palo Alto
  21. >in march 1991 - it's a nice looking book but I never touched
  22. >more than the table of contents with my eyes, but my friends
  23. >are very impressed.........
  24. >
  25. >So the question to the audience is, is this real good C++ style or
  26. >is our comipler buggy.......
  27. >
  28. >
  29. >> ////////////////////////////////////////////////////
  30. >>
  31. >> #include <iostream.h>
  32. >> void main()
  33. >> {
  34. >>   double a, b, c, d, e, f, g, h;
  35. >>   a = 0.0;
  36. >>   b = 0.5;
  37. >>   c = 1.0;
  38. >>   d = 1.5;
  39. >>   e = 1.0/2.0;
  40. >>   f = +0.5;
  41. >>   g = 5e-1;
  42. >>   h = 1/2;      // this is no mistake, just a well known
  43. >>                 // C trick for testing purposes
  44. >>
  45. >>   cout << "Variations for 1/2 (in C++):\n\n";
  46. >>
  47. >>   cout << " a = " << a << " should be 0.0 \n";
  48. >>   cout << " b = " << b << " should be 0.5 \n";
  49. >>   cout << " c = " << c << " should be 1.0 \n";
  50. >>   cout << " d = " << d << " should be 1.5 \n";
  51. >>   cout << " e = " << e << " should be 0.5 \n";
  52. >>   cout << " f = " << f << " should be 0.5 \n";
  53. >>   cout << " g = " << g << " should be 0.5 \n";
  54. >>   cout << " h = " << h << " should be 0.0 (!)\n";
  55. >>
  56. >> } // main
  57. >>
  58. >> ////////////////////////////////////////////////////////
  59. >>
  60. >> That's the output:
  61. >>
  62. >> Variations for 1/2 (in C++):
  63. >>
  64. >>  a = 0 should be 0.0
  65. >>  b = 0 should be 0.5
  66. >>  c = 1 should be 1.0
  67. >>  d = 1 should be 1.5
  68. >>  e = 0.5 shoulbe d 0.5
  69. >>  f = 0 should be 0.5
  70. >>  g = 0.5 shoulbe d 0.5
  71. >>  h = 0 should be 0.0 (!)
  72. >>
  73. >> ////////////////////////////////////////////////////////
  74. >
  75. >thanks for your comments
  76. >
  77. >-frank-
  78. >
  79. >
  80. >
  81. >
  82. >
  83. >
  84. >
  85. >
  86. >.----------------------------------------------------------------------.
  87. >| E-Mail: FRANVM3(KRAEMERF)                 - IBM VNET  "Yes, I'm one  |
  88. >| ======  IBMMAIL(DEIBM27S)                 - IBM-Mail   of those      |
  89. >|         DE.IBMX400.IBMMAIL.KRAEMER.KRAEME - X.400      stupid IBM    |
  90. >|         kraemerf@franvm3.vnet.ibm.com     - Internet   field SE's."  |
  91. >| Voice : +49-(0)611/776-364                                           |
  92. >| Mail  : Abraham-Lincoln Street 26, 6200 Wiesbaden, Germany           |
  93. >'----------------------------------------------------------------------'
  94.  
  95. With xlC at level 1.1.2 running under aix 3.2.2 I got the following:
  96.     Variations for 1/2 (in C++):
  97.     
  98.      a = 0 should be 0.0 
  99.      b = 0.5 should be 0.5 
  100.      c = 1 should be 1.0 
  101.      d = 1.5 should be 1.5 
  102.      e = 0.5 should be 0.5 
  103.      f = 0.5 should be 0.5 
  104.      g = 0.5 should be 0.5 
  105.      h = 0 should be 0.0 (!)
  106.  
  107. Make sure that you are running the current xlC as the latest release came
  108. out in late 92.
  109.  
  110. Tom Merrick
  111. Ohio State University
  112.