cvs.gedasymbols.org/archives/browse.cgi | search |
From: | "Andrew Reid" <ac_reid AT hotmail DOT com> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: problem with new[] using djgpp egcs |
Date: | Tue, 6 Apr 1999 12:18:37 +1200 |
Organization: | University of Canterbury |
Lines: | 28 |
Message-ID: | <7ebjqs$h68$1@cantuc.canterbury.ac.nz> |
References: | <7e1h02$7nu$1 AT cantuc DOT canterbury DOT ac DOT nz> <37050A0F DOT 65333935 AT cartsys DOT com> <37053976 DOT 4287985 AT news3 DOT ibm DOT net> |
NNTP-Posting-Host: | acr28.tacacs.canterbury.ac.nz |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 5.00.2014.211 |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2014.211 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Mark E <snowball3 AT usa DOT net> wrote: > The problem is that you can't initialize an array allocated by new[] like > you can a single object allocated by plain new. In the case of new[], the > default constructor is called for each element. The other compilers > shouldn't have accepted this code, but also the error message given by the > compiler was less than clear. This is my point! My understanding is... With plain old new, you have a choice of constructors to call T* = new T - call the default constructor T* = new T( const T& ) - call the copy constructor and if we were using djgpp(2.02) gcc 2.8.1 we could do the same with new[] T* = new T[n] - call the default constructor for each member of the array T* = new T[n]( const T& ) - call the copy constructor for each member of the array (***) however with djgpp egcs 1.1.2 the line marked (***) causes an error iff T is a built in type. Why the discrepancy - does one of the djgpp compilers have a bug? (Note relevance to djgpp Nate :-)
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |