In aid of my one-man quest to populate SO with D questions (=p), I've run into another problem; initialising an array of structs globally. Observe:
struct A
{
int a;
float b;
}
A[2] as;
as[0] = {0, 0.0f};
as[1] = {5, 5.2f};
void main() {}
Results in:
$ dmd wtf.d
wtf.d(8): no identifier for declarator as[0]
wtf.d(9): no identifier for declarator as[1]
Looking through the docs at Digital Mars, I can't really see anything entirely obvious to me, so I turn once more to the brave denizens of Stack Overflow! I'm guessing the error message doesn't have much to do with the real problem, as surely as[0] is an identifier (but dmd
thinks it's a declarator, which AFAICT looking over the docs, it isn't)?