Am Sat, 29 Jun 2013 17:38:38 +0200 schrieb "monarch_dodra" <monarchdo...@gmail.com>:
> On Saturday, 29 June 2013 at 08:01:17 UTC, Johannes Pfau wrote: > > Shouldn't doing anything value-related on > > an empty struct be invalid anyway? > > Why ? > > The fact that the struct has no members is an implementation > detail which should have no impact on the user of the struct. It's probably a matter of perception. As you said in your other post there are good reasons to give empty structs a size. But if you (naively) think of a struct as a simple aggregate of other types, then a aggregate of zero other types should have size zero. There's no information in such a struct which would have to take up space. And doing something value-related on some type which doesn't have a size and therefore doesn't have a value is not really well-defined. (How do you copy a value of size 0? What happens if you dereference a pointer to a value of size 0?).