www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - delete and CommaExp.

reply Dave <Dave_member pathlink.com> writes:
Is this now illegal? As of v0.146 the compiler no longer allows it.

void main()
{
int[] a = new int[10], b = new int[10];
delete a, b; // 'var has no effect in expression (b)
}
Feb 10 2006
next sibling parent reply "Derek Parnell" <derek psych.ward> writes:
On Sat, 11 Feb 2006 16:20:53 +1100, Dave <Dave_member pathlink.com> wrote:

 Is this now illegal? As of v0.146 the compiler no longer allows it.

 void main()
 {
 int[] a = new int[10], b = new int[10];
 delete a, b; // 'var has no effect in expression (b)
 }
What made you think that the syntax for 'delete' was DeleteExpression :: 'delete' <identifier> (',' <identifier>)... On the other hand, I can't find the formal definition of it anywhere in the D documentation. -- Derek Parnell Melbourne, Australia
Feb 10 2006
parent reply Dave <Dave_member pathlink.com> writes:
In article <op.s4snk3k56b8z09 ginger.vic.bigpond.net.au>, Derek Parnell says...
On Sat, 11 Feb 2006 16:20:53 +1100, Dave <Dave_member pathlink.com> wrote:

 Is this now illegal? As of v0.146 the compiler no longer allows it.

 void main()
 {
 int[] a = new int[10], b = new int[10];
 delete a, b; // 'var has no effect in expression (b)
 }
What made you think that the syntax for 'delete' was DeleteExpression :: 'delete' <identifier> (',' <identifier>)...
C++, and because it worked up until v0.146.
On the other hand, I can't find the formal definition of it anywhere in  
the D documentation.
Feb 10 2006
parent reply Nick <Nick_member pathlink.com> writes:
In article <dsjvfq$ecp$1 digitaldaemon.com>, Dave says...
What made you think that the syntax for 'delete' was

    DeleteExpression :: 'delete' <identifier> (',' <identifier>)...
C++, and because it worked up until v0.146.
Well, it never actuall worked in D, so it's a good thing dmd now complains about it. And are you sure it actually works in C++, or does it do the same thing? (I sincerely don't know.) Nick
Feb 11 2006
parent Dave <Dave_member pathlink.com> writes:
In article <dskgmo$1fdq$1 digitaldaemon.com>, Nick says...
In article <dsjvfq$ecp$1 digitaldaemon.com>, Dave says...
What made you think that the syntax for 'delete' was

    DeleteExpression :: 'delete' <identifier> (',' <identifier>)...
C++, and because it worked up until v0.146.
Well, it never actuall worked in D, so it's a good thing dmd now complains about it. And are you sure it actually works in C++, or does it do the same thing? (I sincerely don't know.) Nick
No it doesn't work in C++ either.. Sorry, I've been stuck on stupid all week it seems. I'd like to think it's not permanent but others may disagree <g> - Dave
Feb 11 2006
prev sibling parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Dave" <Dave_member pathlink.com> wrote in message 
news:dsjs7l$ai9$1 digitaldaemon.com...
 Is this now illegal? As of v0.146 the compiler no longer allows it.

 void main()
 {
 int[] a = new int[10], b = new int[10];
 delete a, b; // 'var has no effect in expression (b)
 }
Delete accepts only one parameter. What's happening here is that delete binds more tightly than comma, so it's something like writing delete a; b; And no-ops, such as "b;" have been made illegal (as they always have been in the spec but were never implemented).
Feb 10 2006
parent Dave <Dave_member pathlink.com> writes:
In article <dsjudn$d09$1 digitaldaemon.com>, Jarrett Billingsley says...
"Dave" <Dave_member pathlink.com> wrote in message 
news:dsjs7l$ai9$1 digitaldaemon.com...
 Is this now illegal? As of v0.146 the compiler no longer allows it.

 void main()
 {
 int[] a = new int[10], b = new int[10];
 delete a, b; // 'var has no effect in expression (b)
 }
Delete accepts only one parameter. What's happening here is that delete binds more tightly than comma, so it's something like writing delete a; b; And no-ops, such as "b;" have been made illegal (as they always have been in the spec but were never implemented).
That would explain it. Thanks, - Dave
Feb 10 2006