Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!cerc.utexas.edu!lynch From: lynch@cerc.utexas.edu (Tom Lynch) Newsgroups: comp.lang.c++ Subject: Re: delete [] Summary: delete takes a type Keywords: delete class [] Message-ID: <1990Jul27.231220.8396@cerc.utexas.edu> Date: 27 Jul 90 23:12:20 GMT References: <641@atcmpe.atcmp.nl> Sender: Tom Lynch Followup-To: lynch@cerc.utexas.edu Distribution: na Organization: University of Texas at Austin Lines: 36 In article <641@atcmpe.atcmp.nl> leo@atcmp.nl (Leo Willems) writes: >When shifting from 2.0 to 2.1 I found myself in problems with: > >func(){ > classtype *m = new classtype[10]; > > delete[10] m; >} > >In 2.0 this works fine, in 2.1 not, that compilers suggests: > > delete [] m; > >which indeed works correct. (but not in 2.0, which accepts the code but >generates a .c file with a syntax error) > >Is delete[] indeed the correct way ? >Should delete[] be accepted by 2.0 or is it new to 2.1? delete m; would be sufficient. delete [10] m is redundant Stroustrup p 259: "In the form delete [ expression ] expression the second expression points to a vector and first expression gives the number of elements of that vector. Specifying the number of elements is redundant except when deleting vectors of certain classes..." I don't know what delete [] m means. -tom lynch@cerc.utexas.edu Nothing is absolute. p.s. please send me a note if this posted. Does anyone use the 'F' in rn? should it work?