* is it a bug?
@ 1998-04-30 10:25 JC Loredo-Osti
1998-04-30 15:45 ` Joe Buck
0 siblings, 1 reply; 4+ messages in thread
From: JC Loredo-Osti @ 1998-04-30 10:25 UTC (permalink / raw)
To: egcs-bugs, egcs
Both, egcs-19980418 and egcs-19980425, complain about the follwing code
main(){
double *p = new double[3](0);
}
However it does compile with egcs-1.0.2 and gcc-2.8.x
(With gcc-2.7.2 it gets a internal compiler error which is supresed by
replacing '(0)' with '(0.0)')
Is it a bug or new feature?
-j
josti@mscs.dal.ca
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: is it a bug?
1998-04-30 10:25 is it a bug? JC Loredo-Osti
@ 1998-04-30 15:45 ` Joe Buck
1998-04-30 13:20 ` JC Loredo-Osti
0 siblings, 1 reply; 4+ messages in thread
From: Joe Buck @ 1998-04-30 15:45 UTC (permalink / raw)
To: JC Loredo-Osti; +Cc: egcs-bugs, egcs
> 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).
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: is it a bug?
1998-04-30 15:45 ` Joe Buck
@ 1998-04-30 13:20 ` JC Loredo-Osti
0 siblings, 0 replies; 4+ messages in thread
From: JC Loredo-Osti @ 1998-04-30 13:20 UTC (permalink / raw)
To: Joe Buck; +Cc: egcs-bugs, egcs
>
> > 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.
>
Yes, I have seen some of those. For this one I look into some books and I
didn't read nothing about it.
Thanks a lot,
-j
^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <199712081205.NAA25992@vbormc.vbo.dec.com>]
end of thread, other threads:[~1998-04-30 15:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-04-30 10:25 is it a bug? JC Loredo-Osti
1998-04-30 15:45 ` Joe Buck
1998-04-30 13:20 ` JC Loredo-Osti
[not found] <199712081205.NAA25992@vbormc.vbo.dec.com>
[not found] ` <orvhwzzkd1.fsf.cygnus.egcs.bugs@grupiara.dcc.unicamp.br>
1997-12-08 22:22 ` Is it a bug ? Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).