On Saturday, 29 June 2013 at 08:01:17 UTC, Johannes Pfau wrote:
Am Fri, 28 Jun 2013 22:16:33 +0200
schrieb Andrej Mitrovic <andrej.mitrov...@gmail.com>:

On 6/28/13, Johannes Pfau <nos...@example.com> wrote:
> A naive question: Why isn't struct S {} enough? This should > be a > struct with size 0 so why do we need to disable the > constructor and
> postblit explicitly?

Because the user should never be able to use such a struct by value,
in other words a user might mistakenly write code such as:

    S s2 = *s;  // copies 1 byte

But why is that legal / does that copy _one_ byte? It seems like that's
totally arbitrary. Shouldn't doing anything value-related on
an empty struct be invalid anyway?

It copies one byte because empty structs have one byte - according to D implementation. The value can be adjusted using align() atrribute.

Reply via email to