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: ----- struct S { } extern(C) S* get(); extern(C) void call(S*); void main() { S* s = getS(); S s2 = *s; // copies 1 byte call(&s2); // no telling what will happen on the C side, usually memory corruption + crash } -----