Immutable fields

bearophile bearophileHUGS at lycos.com
Tue Nov 2 17:54:35 PDT 2010


Is it correct for immutable struct fields to act like enum or static const fields? (I don't think so, but I am wrong often):

struct Foo {
    immutable int x = 1;
}
static assert(Foo.sizeof == 4);
void main() {}


More info in the D.learn thread:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=22540

Thank you,
bearophile


More information about the Digitalmars-d mailing list