sizeof struct no less than 1?

Mike none at none.com
Fri Mar 21 19:29:41 PDT 2014


On Saturday, 22 March 2014 at 02:27:02 UTC, Mike wrote:
> Hello,
>
> Consider an 'empty' struct as follows:
>
> struct Test {}
>
> When printing it's size, it's always 1.
> void main()
> {
>     writeln(Test.sizeof);
> }
>
> Output:
> 1
>
> Why is it not 0?  What about struct Test is consuming 1 byte of 
> memory?
>
> Thanks,
> Mike

Looks like this answers my question:
http://forum.dlang.org/post/l03oqc$mpq$1@digitalmars.com


More information about the Digitalmars-d-learn mailing list