Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!cimshop!davidm From: cimshop!davidm@uunet.UU.NET (David S. Masterson) Newsgroups: comp.lang.c++ Subject: Re: delete [] Message-ID: Date: 7 Aug 90 06:01:10 GMT References: <641@atcmpe.atcmp.nl> <1990Jul27.231220.8396@cerc.utexas.edu> <4937@pegasus.ATT.COM> <4942@pegasus.ATT.COM> <4956@pegasus.ATT.COM> Sender: news@cimshop.UUCP Distribution: comp Organization: Consilium Inc., Mountain View, California. Lines: 45 In-reply-to: hansen@pegasus.ATT.COM's message of 5 Aug 90 12:51:36 GMT In article <4956@pegasus.ATT.COM> hansen@pegasus.ATT.COM (Tony L. Hansen) writes: < From: cimshop!davidm@uunet.UU.NET (David S. Masterson) < Hmmmm. If someone had developed X for an embedded system such that < X.new() allocates space for X in a special memory area, then X could never < "validly" be used in an array form because "new X[m]" would cause it to be < allocated in standard memory. Does anyone see a problem with this? If you're developing such a class, then you do indeed have to be aware of the ins and outs of arrays. Be careful when you play around with "special memory segments"! You didn't answer the question !-) Perhaps you missed the point of the question (nah! ;-). Obviously, by the current definition of the language, there are some gotchas with the scenario above, but the question is should those gotchas exist? Why? Just to throw in another monkey wrench, it is possible to explicitly call X::~X() for an allocated variable; this is sometimes necessary when dealing with those "special memory segments" mentioned above. (This feature was introduced in the 1989 definition of the language, a.k.a. 2.0.) Is this a trick to deal with the above? Should a language consider a special trick for not too-special cases a language "feature"? Wait a sec (looking at above a little more cross-eyed), how would the explicit call to X::~X() work for this case?? < There must be plusses and minusses with either way. < [of tracking array sizes] I suppose it WOULD be possible for an implementation to keep track at compile time for SOME arrays, but that would be a matter of "quality of implementation" and is not a language issue. Why SOME arrays? The information is there at compile time for all arrays, isn't it? (NOTE: I didn't say pointers to arrays.) I think the "quality" belongs more in the definition of the language than the implementation. -- =================================================================== 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!"