digitalmars.D.bugs - private static bug
-
imr1984
(16/16)
Apr 20 2005
- Thomas Kuehne (16/32) Apr 20 2005 -----BEGIN PGP SIGNED MESSAGE-----
<other.d> class MyClass { static: private int _staticVariable; } <main.d> void test() { MyClass mc = new MyClass(); mc._staticVariable;//NOT accessible (correct) MyClass._staticVariable;//IS accessible (bug in compiler) return; } As you can see from this example, private static variables can still be accessed from outside the module, if the private static is called from its class.
Apr 20 2005
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 imr1984 schrieb am Wed, 20 Apr 2005 10:13:27 +0000 (UTC):<other.d> class MyClass { static: private int _staticVariable; } <main.d> void test() { MyClass mc = new MyClass(); mc._staticVariable;//NOT accessible (correct) MyClass._staticVariable;//IS accessible (bug in compiler) return; } As you can see from this example, private static variables can still be accessed from outside the module, if the private static is called from its class.Added to DStress as http://dstress.kuehne.cn/nocompile/private_05.d http://dstress.kuehne.cn/nocompile/private_06.d http://dstress.kuehne.cn/addon/private_05_A.d http://dstress.kuehne.cn/nocompile/package_01.d http://dstress.kuehne.cn/nocompile/package_02.d http://dstress.kuehne.cn/addon/package_01_A.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCZlKM3w+/yD4P9tIRAh0uAJ9+qsuABCM41AA22+KHT0y4iD5HQgCfe2bJ /OIHleuAJ7ooPgqPEbcABbw= =tzAG -----END PGP SIGNATURE-----
Apr 20 2005