Definitive list of storage classes
Jens Mueller
jens.k.mueller at gmx.de
Sun Apr 15 09:44:27 PDT 2012
Jonathan M Davis wrote:
> I'd like to know which modifiers are considered to be storage classes. The term
> seems to be used on a lot more than actually qualifies (including using the
> term for the type qualfiers: const, immutable, and shared), and even the
> documentation uses it on stuff that I wouldn't have thought would be considered
> storage classes, because they have no effect on how variables are stored or
> linked (e.g. synchronized).
>
> Someone asked about it on stackoverflow, and my explanation is not as good as
> it should be simply because I can't find a definitive list anywhere:
>
> http://stackoverflow.com/questions/10150510/what-are-the-storage-classes-in-d
I would say that static is the only storage class. By default data is
thread local and not shared.
enum is not a storage class because nothing is stored here (I mean in
memory at run time).
extern is not a storage class. Because it just says that the symbol
needs to be resolved at link-time.
lazy says something about time of evaluation not how a variable's memory
is stored.
out is about parameter passing. Same for ref. So I think ref is not a
storage class. If it was I would expect ref a = 10 to be valid code.
Don't know about scope. I never used it. Is it going to be deprecated,
isn't is?
Jens
More information about the Digitalmars-d
mailing list