Mail Archives: djgpp/1999/02/05/20:36:06
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 -