What does 'scope' mean for non-class types?

div0 div0 at users.sourceforge.net
Sat May 29 15:15:00 PDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lars T. Kyllingstad wrote:
> In D2, what is the effect (if any) of 'scope' in the following situations?
> 
>   scope int a;

Nothing

> 
>   struct B { ... }
>   scope B b;

Nothing, B's destructor will be called even without scope.

> 
>   scope int[] c;

c gets deleted when the scope ends. this applies to classes as well.

> 
>   // According to the spec, 'in' is shorthand for 'const scope'.
>   void foo(in char[] d) { ... }

d is const (read only).
I've no idea why scope is mentioned, it's meaningless in the context
of function arguments.

- --
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFMAZHkT9LetA9XoXwRAkDMAKCRPhWUbfGkWD5bKafe7EEobTzmgQCeKkEm
YmIbhSYIkyQnjgwk+9GH2U8=
=NoeB
-----END PGP SIGNATURE-----


More information about the Digitalmars-d-learn mailing list