Difference betwee storage class and type (invariant/const)?
Kirk McDonald
kirklin.mcdonald at gmail.com
Mon Jun 18 12:15:13 PDT 2007
Robert Fraser wrote:
> Can someone explain to me what the difference is between a storage class and a type is, with regards to const and invariant? For example, what do these do differently?
>
> invariant int foo;
> invariant(int) foo;
>
> ...? I know this is probably second-nature to people with C++ backgrounds, but I find the documentation quite confusing, as I've only really worked in Java before.
Between those? Nothing. The difference is here:
invariant int* foo;
invariant(int)* bar;
The former is equivalent to:
invariant(int*) foo;
That is, when it is used as a storage class, it applies to the whole type.
--
Kirk McDonald
http://kirkmcdonald.blogspot.com
Pyd: Connecting D and Python
http://pyd.dsource.org
More information about the Digitalmars-d-learn
mailing list