This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: is it a bug?
- To: josti at mscs dot dal dot ca (JC Loredo-Osti)
- Subject: Re: is it a bug?
- From: Joe Buck <jbuck at Synopsys dot COM>
- Date: Thu, 30 Apr 98 12:47:08 PDT
- Cc: egcs-bugs at cygnus dot com, egcs at cygnus dot com
> Both, egcs-19980418 and egcs-19980425, complain about the follwing code
> main(){
> double *p = new double[3](0);
> }
That's because it isn't C++. g++ used to have an extension that allowed
the use of constructor arguments with arrays, but it hasn't been
maintained and the egcs team wants to encourage people to program in C++,
not a strange dialect called g++. So you are likely to see the more
questionable GNU extensions eliminated.
If you need to do something like this (an array of values each of which
is initialized using constructor arguments), use vector<double> instead:
vector<double> p(3,0.0);
(saying p(3,0) here will result in trouble -- yet another problem).