From -3830936314649498945 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f78e5,8372ae6de42be399 X-Google-Attributes: gidf78e5,public X-Google-ArrivalTime: 2004-02-22 18:55:01 PST Return-Path: X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!zeus.visi.com!news-out.visi.com!priapus.visi.com!orange.octanews.net!news.octanews.net!green.octanews.net!news-out.octanews.net!news.glorb.com!newsfeed2.telusplanet.net!newsfeed.telus.net!cyclone.bc.net!news.alt.net!comp-std-cpp-robomod!not-for-mail X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov) Delivered-To: std-c++@ucar.edu From: wizofaus@hotmail.com (Dylan Nicholson) Newsgroups: comp.std.c++ Subject: Re: Array of size 0 Organization: http://groups.google.com Message-ID: <7d428a77.0402221805.51174786@posting.google.com> References: <403601F6.8010706@ircad.u-strasbg.fr> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1077501901 25305 127.0.0.1 (23 Feb 2004 02:05:01 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 23 Feb 2004 02:05:01 +0000 (UTC) X-Spamscanner: mailbox5.ucsd.edu (v1.4 Oct 30 2003 22:20:52, 0.1/5.0 2.63) X-MailScanner: PASSED (v1.2.8 74032 i1N251TW080628 mailbox5.ucsd.edu) X-Spam-Checker-Version: SpamAssassin 2.60-mulga_r1 (1.212-2003-09-23-exp) on mulga.cs.mu.OZ.AU X-Spam-Status: No, hits=0.1 required=5.2 tests=AWL,FORGED_HOTMAIL_RCVD2 autolearn=no version=2.60-mulga_r1 Approved: Fergus Henderson , moderator of comp.std.c++ Date: Sun, 22 Feb 2004 20:50:30 CST Lines: 29 Xref: archiver1.google.com comp.std.c++:1198 Gabriel Dos Reis wrote in message news:... > stephen.clamage@sun.com (Steve Clamage) writes: > > | Now consider > | int* myArray = new int[n]; > | If n were not allowed to be zero, the runtime system would have to > | check for zero elements and generate some kind of runtime error, > | probably an exception. The program would have to check specially for > | zero size or be prepared to deal with the exception -- perhaps in many > | places. > > Is that really different from the current behaviour whereby the > new-expression can throw because of shortage of storage and the > program has to check? > Well surely one is an 'exception' (and on modern OS-es, it is truly exceptional for a memory allocation to fail), where the other might be a usual, expected case. I can you tell it's a definite pain that at least one popular compiler produces a crash when trying to delete [] the result of new TYPE[0]. Dylan --- [ comp.std.c++ is moderated. To submit articles, try just posting with ] [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]