home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / sgi / 13142 < prev    next >
Encoding:
Text File  |  1992-09-01  |  1.7 KB  |  49 lines

  1. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!jvnc.net!yale.edu!ira.uka.de!chx400!sicsun!siisg1.epfl.ch!lapique
  2. From: lapique@siisg1.epfl.ch (Francis Lapique)
  3. Newsgroups: comp.sys.sgi
  4. Subject: C++ 3.0
  5. Message-ID: <3922@sicsun.epfl.ch>
  6. Date: 1 Sep 92 15:45:24 GMT
  7. Sender: news@sicsun.epfl.ch
  8. Lines: 39
  9.  
  10. The following  code illustrates an anomaly between
  11. IRIX 4.0.5 maint C++3.0 and version IRIX 4.0.5 C++2.1.1:
  12. -----------------------------------------------------------
  13. #include <string.h>
  14. class String {
  15.   private:
  16.      char *data;
  17.   public:
  18.      String(char *value =0){ 
  19.          data = new char[strlen(value) + 1];
  20.          strcpy(data,value);
  21.      }
  22. };
  23. main()
  24. {
  25.     const String B = "Hello World";
  26. }
  27. -------------------------------------------------------------
  28. Compiled with C++3.0 :
  29.  
  30. accom: Error: string.C, line 13: __2__X1 undefined
  31.        struct String __1B = (*( (__2__X1 = "Hello World"), ( ((
  32.        -------------------------------------------------^
  33. accom: Error: string.C, line 13: illegal combination of pointer and integer, op =
  34.        struct String __1B = (*( (__2__X1 = "Hello World"), ( ((
  35.        -------------------------------------------------^
  36. accom: Error: string.C, line 13: types :   int  versus   pointer to char
  37.        struct String __1B = (*( (__2__X1 = "Hello World"), ( ((
  38.        -------------------------------------------------^
  39. accom: Error: string.C, line 14: redeclaration of __2__X1
  40.        char *__2__X1 = 0 ;
  41.        --------------^
  42. Compiled with C++2.1.1 : OK
  43. ---------------------------------------------------------------------
  44. Francis Lapique
  45. Swiss Federal Institute of Technology-Lausanne
  46. Computer Center-SIC/SII
  47. E-mail : lapique@sic.epfl.ch
  48. voice : 41-21-693-4596
  49.