Path: utzoo!attcan!uunet!cs.utexas.edu!news-server.csri.toronto.edu!utgpu!watserv1!mgardi From: mgardi@watserv1.waterloo.edu (Mutual Life) Newsgroups: comp.lang.c++ Subject: Re: The type yielded by "new T[expression]" Message-ID: <1550@watserv1.waterloo.edu> Date: 21 Mar 90 17:55:04 GMT References: <26068361.27247@paris.ics.uci.edu> Organization: University of Waterloo Lines: 47 In article <26068361.27247@paris.ics.uci.edu> rfg@paris.ics.uci.edu (Ronald Guilmette) writes: >One minor footnote. It was formerly the case that any attempts to "delete" >arrays of objects had to include a square-bracketed size expression in >the delete statement, i.e.: > > delete [size] ptr; > >It appears that this has changed recently, and that the proper way to do >this now is simply: > > delete [] ptr; > I came across some interesting code in the C++ work conference proceedings. here goes: str = new char[length + 1]; ... delete [length + 1] str; I assume this is not necessary (is it correct?) for built in types.... Also, in the string class mentioned in the 'first course in c++', they do the following: String& String::operator=(const String& right) { if (this == &right) return *this; well...my compiler (zortech) complains about this (appropriately I think?) and I have to use a temporary 'const String temp' to do the comparison to 'right'. Is this the way it should be? Why the problem...I am taking an address of a const, but not for assignment... p. Peter DeVries Mutual Life of Canada c/o mgardi@watdcsu (519) 888-3523 (416) 972-0594 My opinions/comments are mine, and mine only, and have nothing to do with what Mutual Life of Canada thinks (now isn't that an understatement!) p.