On Sat, 04 May 2013 14:11:02 -0400, jerro <[email protected]> wrote:

Is there a way to avoid default initializing a struct field in D? The following doesn't seem to work:

struct Foo
{
     int[42] buffer = void;
     int bar;
}

I know I can do this:

Foo foo = void

But then all fields are uninitialized.

Foo.init must exist, and be filled with *something*. Is it useful to FORCE buffer to not have 0 values? Or is it that you don't care what it has? In the latter, is it terrible that it's 0?

I tend to think that without the bar there, it could potentially be uninitialized (not sure if this is the case). But as long as it's there, buffer must also be initialized.

-Steve

Reply via email to