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

  1. Path: sparky!uunet!olivea!sgigate!odin!sgihub!zola!void!thant
  2. From: thant@void.esd.sgi.com (Thant Tessman)
  3. Newsgroups: comp.sys.sgi
  4. Subject: Re: C++ 3.0
  5. Message-ID: <pad8ogo@zola.esd.sgi.com>
  6. Date: 1 Sep 92 17:09:05 GMT
  7. References: <3922@sicsun.epfl.ch>
  8. Sender: news@zola.esd.sgi.com (Net News)
  9. Organization: Silicon Graphics, Inc.  Mountain View, CA
  10. Lines: 58
  11.  
  12.  
  13. So what's really weird is if you replace the line:
  14.  
  15.  
  16. >     const String B = "Hello World";
  17.  
  18. with:
  19.  
  20.     char* s = "Hello World";
  21.     const String B = s;
  22.  
  23. It works.  Looks like a compiler bug to me.  I will forward 
  24. to the appropriate people.
  25.  
  26. thant
  27.             
  28.  
  29.  
  30. In article <3922@sicsun.epfl.ch>, lapique@siisg1.epfl.ch writes:
  31. > The following  code illustrates an anomaly between
  32. > IRIX 4.0.5 maint C++3.0 and version IRIX 4.0.5 C++2.1.1:
  33. > -----------------------------------------------------------
  34. > #include <string.h>
  35. > class String {
  36. >   private:
  37. >      char *data;
  38. >   public:
  39. >      String(char *value =0){ 
  40. >          data = new char[strlen(value) + 1];
  41. >          strcpy(data,value);
  42. >      }
  43. > };
  44. > main()
  45. > {
  46. >     const String B = "Hello World";
  47. > }
  48. > -------------------------------------------------------------
  49. > Compiled with C++3.0 :
  50. > accom: Error: string.C, line 13: __2__X1 undefined
  51. >        struct String __1B = (*( (__2__X1 = "Hello World"), ( ((
  52. >        -------------------------------------------------^
  53. > accom: Error: string.C, line 13: illegal combination of pointer and integer, op =
  54. >        struct String __1B = (*( (__2__X1 = "Hello World"), ( ((
  55. >        -------------------------------------------------^
  56. > accom: Error: string.C, line 13: types :   int  versus   pointer to char
  57. >        struct String __1B = (*( (__2__X1 = "Hello World"), ( ((
  58. >        -------------------------------------------------^
  59. > accom: Error: string.C, line 14: redeclaration of __2__X1
  60. >        char *__2__X1 = 0 ;
  61. >        --------------^
  62. > Compiled with C++2.1.1 : OK
  63. > ---------------------------------------------------------------------
  64. > Francis Lapique
  65. > Swiss Federal Institute of Technology-Lausanne
  66. > Computer Center-SIC/SII
  67. > E-mail : lapique@sic.epfl.ch
  68. > voice : 41-21-693-4596
  69.