How to initialize static array member variable?
Simen kjaeraas
simen.kjaras at gmail.com
Fri Oct 1 03:29:33 PDT 2010
Sebastian Schuberth <sschuberth at gmail.com> wrote:
> As a side note, I find the syntax quite unfortunate. It reads to me as
> if the static constructor will only be called if the default constructor
> is used (I know, this does not make sense as the static constructor will
> be called before main, and before any non-static constructor). Still, I
> wonder why not simply the Java syntax
>
> static {
> // ...
> }
>
> was adopted.
One reason could be that {} are used for grouping in D. e.g all methods
of this struct are static:
struct foo {
static {
void bar( ) {};
string baz( ) {return "Ouch, you poked me!";}
}
}
--
Simen
More information about the Digitalmars-d-learn
mailing list