home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / std / cplus / 1509 < prev    next >
Encoding:
Internet Message Format  |  1992-11-08  |  1.3 KB

  1. Path: sparky!uunet!mcsun!uknet!news.cs.bham.ac.uk!bham!bhamvx!mccauleyba
  2. From: mccauleyba@vax1.bham.ac.uk (Brian McCauley)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Initialization of const dynamic objects
  5. Message-ID: <1992Nov7.155717.1@vax1.bham.ac.uk>
  6. Date: 7 Nov 92 15:57:17 GMT
  7. References: <1deqlgINNmc0@darkstar.UCSC.EDU>
  8. Sender: usenet@rs6000.bham.ac.uk (USENET News Service)
  9. Organization: University of Birmingham
  10. Lines: 24
  11.  
  12. In article <1deqlgINNmc0@darkstar.UCSC.EDU>, daniel@cse.ucsc.edu (Daniel R. Edelson) writes:> 
  13. >     new const int;
  14. > This allocates an uninitialized const object. 
  15. > Seems like this should be explicitly prohibited (assuming
  16. > there's no constructor, of course.) Is it?
  17. > ...
  18. > None of the compilers I tested detected this error.
  19.  
  20. Borland 3.1 does detect it. In fact I don't think it is necessary for a
  21. compiler to spot such a mistake as the action of `new const int' is perfectly
  22. well defined even if utterly useless!
  23.  
  24. BTW Borland rejects    `new const A' (an implicit call to A::A()) but not
  25. `new const A()' (an explicit call to A::A())
  26.  
  27. Does anyone know if this is the _standard_ behaviour?
  28.  
  29.     \\   ( )  NO BULLSHIT! from BAM (Brian McCauley)          
  30.  .  _\\__[oo  ============
  31. .__/  \\ /\@
  32. .  l___\\     E-mail: B.A.McCauley@bham.ac.uk
  33.  # ll  l\\ 
  34. ###LL  LL\\
  35.