www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Using 'return new int[];'

reply D. Trebbien <D._member pathlink.com> writes:
Is this a bug?

int[] getStuff()
{
return new int[];
}

If not, maybe it should be added to the spec? This would also be nice:

int[] getStuff()
{
return new int[] [3,2,1,-4];
}
May 30 2005
parent Stewart Gordon <smjg_1998 yahoo.com> writes:
D. Trebbien wrote:
 Is this a bug?
 
 int[] getStuff()
 {
 return new int[];
 }
Where did you find that code? What do you think it should be instead?
 If not, maybe it should be added to the spec? This would also be nice:
 
 int[] getStuff()
 {
 return new int[] [3,2,1,-4];
 }
Several syntaxes have been proposed for array literals. Including yours, which is syntactically ambiguous. http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/4065 Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
May 31 2005