Path: utzoo!attcan!uunet!cimshop!davidm From: cimshop!davidm@uunet.UU.NET (David S. Masterson) Newsgroups: comp.lang.c++ Subject: Re: delete [] Message-ID: Date: 30 Jul 90 17:06:22 GMT References: <641@atcmpe.atcmp.nl> <1990Jul27.231220.8396@cerc.utexas.edu> <4937@pegasus.ATT.COM> Sender: davidm@cimshop.UUCP Distribution: comp Organization: Consilium Inc., Mountain View, California. Lines: 30 In-reply-to: hansen@pegasus.ATT.COM's message of 29 Jul 90 05:00:17 GMT In article <4937@pegasus.ATT.COM> hansen@pegasus.ATT.COM (Tony L. Hansen) writes: < From: lynch@cerc.utexas.edu (Tom Lynch) < delete m; would be sufficient. delete [10] m is redundant Absolutely NOT! Without the [], C++ does not know that it's an array of objects to be deleted instead of a single object, and the destructors would not be called for elements 1..m of the array. Why? I could understand this if m were declared as a pointer and wound up pointing to an array of 10 somethings, but, if m is declared as an array, then why doesn't C++ know "that it's an array of objects to be deleted instead of a single object"? < I don't know what delete [] m means. As I said, your reference is outdated. The latest C++ rules say that the number within the [] is unnecessary and the environment is required to keep track of how many elements are in the array. Isn't this a contradiction of the previous statement? If the environment is keeping track of how many elements are in the array, then doesn't it know that the variable names an array? -- =================================================================== David Masterson Consilium, Inc. uunet!cimshop!davidm Mt. View, CA 94043 =================================================================== "If someone thinks they know what I said, then I didn't say it!"