delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/05/20:36:06

From: richard_fa AT yahoo DOT com
Newsgroups: comp.os.msdos.djgpp
Subject: Re: initalize dynamic array
Date: Sat, 06 Feb 1999 01:04:43 GMT
Organization: Deja News - The Leader in Internet Discussion
Lines: 29
Message-ID: <79g4f5$rn2$1@nnrp1.dejanews.com>
References: <36b9185d DOT 2417500 AT news DOT vnet DOT net> <36bad6cb DOT 272388353 AT news DOT snafu DOT de>
NNTP-Posting-Host: 166.82.121.31
X-Article-Creation-Date: Sat Feb 06 01:04:43 1999 GMT
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)
X-Http-Proxy: 1.1 x1.dejanews.com:80 (Squid/1.1.22) for client 166.82.121.31
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

In article <36bad6cb DOT 272388353 AT news DOT snafu DOT de>,
  horst DOT kraemer AT snafu DOT de (Horst Kraemer) wrote:
> On Thu, 04 Feb 1999 03:48:29 GMT, farich AT vnet DOT net (Fred A Richard)
> wrote:
>
> > I'm having trouble with the following code, whose purpose is to
> > initalize a dynamic array of int's:
> >
> >      int *w = new int[3] = {1,2,3};
> >
> > this compiles and functions fine under the two GCC compilers I've
> > tried (DJGPP v 2.02 and BeOS gcc 2.81), but it does not compile using
> > other compilers (namely, Visual C++ 6.0, Turbo C/C++ v. 3.0 for DOS,
> > Borland C++ 3.1 for DOS).
> >
> > If this statement is not "legal", how could one accomplish the same
> > thing w/o writing lots of lines of code?
>
> You cannot initialize portably a dynamically created array with
> constants. This syntax is a GNU extension which is not conforming to
> the C++ Standard.
>
> Regards
> Horst

Thank you Horst.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019