www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - The array initialization bug

reply Id <Id_member pathlink.com> writes:
D is still carrying this bug for too long, IMHO. When will this be addressed?
Aug 28 2004
parent reply Id <Id_member pathlink.com> writes:
(oops, I had hit the post message by mistake ')

I'm talking about the:
[code]
public static void main()
{
int[] foo=[-1,0,1];
}
[/code]
mod1.d(3) variable foo is not a static and cannot have static initializer

D is still carrying this bug for too long, IMHO. When will this be addressed?
Aug 28 2004
parent reply "Walter" <newshound digitalmars.com> writes:
"Id" <Id_member pathlink.com> wrote in message
news:cgq6q4$2urq$1 digitaldaemon.com...
 I'm talking about the:
 [code]
 public static void main()
 {
 int[] foo=[-1,0,1];
 }
 [/code]
 mod1.d(3) variable foo is not a static and cannot have static initializer

 D is still carrying this bug for too long, IMHO. When will this be

It's not a bug, since it is the way the language is specified. But supporting array (and struct) literals are very good candidates for 2.0 features.
Aug 28 2004
parent Stewart Gordon <smjg_1998 yahoo.com> writes:
Walter wrote:

 "Id" <Id_member pathlink.com> wrote in message
 news:cgq6q4$2urq$1 digitaldaemon.com...

 mod1.d(3) variable foo is not a static and cannot have static initializer

 D is still carrying this bug for too long, IMHO. When will this be 
 addressed?

It's not a bug, since it is the way the language is specified.

Whereabouts is this arbitrary restriction specified, exactly? And what is its advantage? And does this mean it's a misbug that the form's allowed for non-static class members?
 But supporting array (and struct) literals are very good candidates for 2.0
 features.

This isn't exactly an array literal, just the standard array initialisation syntax wanting to work wherever it ought to, and where it works perfectly in plain old C. D/26695 et seq.... Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Sep 01 2004