home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / cplus / 11483 < prev    next >
Encoding:
Text File  |  1992-07-24  |  1.7 KB  |  60 lines

  1. Path: sparky!uunet!elroy.jpl.nasa.gov!ames!agate!dog.ee.lbl.gov!network.ucsd.edu!mvb.saic.com!unogate!beckman.com!dn73!j_ohearn
  2. Newsgroups: comp.lang.c++
  3. Subject: Borland C++ 3.1 fails to conform to C++ Standard
  4. Message-ID: <j_ohearn.711991770@dn73>
  5. From: j_ohearn@dsg4.dse.beckman.com ()
  6. Date: 24 Jul 92 15:29:30 GMT
  7. Distribution: world
  8. Keywords: C++ Standard
  9. Summary: Reference variables and pointers.
  10. Nntp-Posting-Host: dn73.dse.beckman.com
  11. Lines: 47
  12.  
  13.  
  14. Note:  This posting is not my own; I am doing this on behalf of one
  15. of my colleagues, Jack Walker.  However, I think he has a valid
  16. argument.
  17.  
  18. I have been using a version of the following class which is adapted 
  19. from an example in the Borland C++ 3.0 Programmers Guide (page 149):
  20.  
  21. class Vector
  22. {
  23.     double huge *data;
  24.     unsigned long low, high;
  25.  
  26.     public:
  27.  
  28.     Vector ( unsigned long, unsigned long );
  29.     ~Vector(){ delete[] data; }
  30.  
  31.     double& operator()( unsigned long i )
  32.     {
  33.         return data[i - low]; //Line that offends ver 3.1 but compiled without
  34.                               //error under 3.0
  35.     }
  36. };
  37.  
  38. Vector::Vector(unsigned long L, unsigned long H)
  39. {
  40.     low = L;
  41.     high = H;
  42.     data = new double huge[H - L + 1];
  43. }
  44.  
  45. The above class compiled and functioned successfully under version 3.0 
  46. but under version 3.1 I receive the error message:
  47.     "Reference initialized with 'double' requires lvalue of type 'double'"
  48. which referred to the line I have indicated in the above class listing.
  49.  
  50. This contains no syntax error that I am aware of and is essentially given 
  51. in various textbooks on C++ as a method for implementing 'safe arrays'.
  52.  
  53. I would appreciate any assistance regarding this problem.
  54.  
  55.  
  56.  
  57. Send any private responses to (I will make sure Jack gets them):
  58. j_ohearn@dsg4.dse.beckman.com
  59.  
  60.