Definitive list of storage classes

Peter Alexander peter.alexander.au at gmail.com
Sun Apr 15 02:59:53 PDT 2012


On Saturday, 14 April 2012 at 17:50:39 UTC, Jonathan M Davis 
wrote:
> On Sunday, April 15, 2012 01:49:09 Daniel Murphy wrote:
>> There's always the list in 'declaration.h'.
>
> That's clearly not the list, since it includes const, 
> immutable, and shared,
> which are type qualifiers rather than storage classes. It also 
> has stuff like
> init in it, which isn't even vaguely a storage class. All of 
> the storage
> classes may be in that list, but I don't know how you'd figure 
> out which ones
> they are from that list.

As I understand it, const, immutable, and shared are both type 
qualifiers and storage classes. In C++, const is also both a 
storage class and type qualifier, which causes confusion.

// At global scope
immutable int x = 1;
int y = 2;

Here x and y are stored very differently. y is thread local 
whereas x is a program-wide read-only global. It's a similar 
situation with const and shared.


More information about the Digitalmars-d mailing list