home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / cplus / 18207 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  1.2 KB

  1. Path: sparky!uunet!mcsun!sunic!corax.udac.uu.se!Minsk.docs.uu.se!rogerl
  2. From: rogerl@Minsk.docs.uu.se (Roger Lundberg)
  3. Newsgroups: comp.lang.c++
  4. Subject: Bug in BC/C++ 2.0 ?
  5. Date: 18 Dec 92 17:21:49 GMT
  6. Organization: Uppsala University
  7. Lines: 32
  8. Message-ID: <rogerl.724699309@Minsk>
  9. NNTP-Posting-Host: minsk.docs.uu.se
  10. Summary: Is this a bug in BC 2.0 ?
  11. Keywords: bugs
  12.  
  13.  
  14. I recently bought a copy of Borland C/C++ v. 2.0 (I know it's a bit old, but I
  15. got for a decent price :-). So I thought I would try it out with a small prog
  16. that I copied from Stroustrups "The C++ Programming Language" 2nd ed. The prog
  17. was the "class string" example. But BC wouldn't compile ? It barfed at all 
  18. constructs of the following type.
  19.  
  20.  
  21. String::~String() {
  22.   if ( --p->n == 0) {
  23.     delete[] p->s;
  24. /*          ^^^^^ Here does the compiler barf */
  25.     delete p;
  26.   }
  27. }
  28.  
  29.  
  30. It gave an error message indicating that it interpreted the "->" construct as
  31. a minus sign "-" followed by garbage. Is this a bug in BC 2.0 or is the example
  32. in the book at fault ???
  33.  
  34. I have used the same example with gcc with no problems at all.
  35.  
  36.     /Roger
  37.  
  38.  
  39.  
  40. --
  41. Roger Lundberg
  42. E-Mail: rogerl@Minsk.DoCS.UU.SE
  43. Tel.: +46 (0)18-460346
  44. Mail: Sernanders v. 8-512 , S-75261 Uppsala , Sweden
  45.