digitalmars.D.bugs - dmd v0.93 private/public bugs
- Regan Heath (43/43) Jun 26 2004 --[bug.d]--
- Derek (5/63) Jun 26 2004 OTOH, that *does* block access to it (at runtime anyhow) ;-)
- Regan Heath (7/47) Jun 27 2004 Behaviour is unchanged as of v0.94 - good/expected.
--[bug.d]--
module bug3;
struct A {
private int b;
private void foo()
{
printf("%d\n",b);
}
}
--[bug3m.d]--
import bug3;
void main() {
A a;
printf("1\n");
a.b = 10;
printf("2\n");
a.foo();
printf("3\n");
}
D:\D\src\build\temp>dmd bug3.d bug3m.d
D:\d\dmd\bin\..\..\dm\bin\link.exe bug3+bug3m,,,user32+kernel32/noi;
D:\D\src\build\temp>bug3
1
2
10
3
So.. private means nothing in structs?
If I change the struct to a class I get
D:\D\src\build\temp>dmd bug3.d bug3m.d
bug3m.d(6): class A member b is not accessible
bug3m.d(8): class A member foo is not accessible
which is much better.
If I also move the class definition into the same file as main I get:
D:\D\src\build\temp>dmd bug3m.d
D:\d\dmd\bin\..\..\dm\bin\link.exe bug3m,,,user32+kernel32/noi;
D:\D\src\build\temp>bug3m
1
Error: Access Violation
So.. when the class is in the same module private does not block access
but causes an access violation instead.
Regan.
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jun 26 2004
On Sun, 27 Jun 2004 17:32:20 +1200, Regan Heath wrote:
--[bug.d]--
module bug3;
struct A {
private int b;
private void foo()
{
printf("%d\n",b);
}
}
--[bug3m.d]--
import bug3;
void main() {
A a;
printf("1\n");
a.b = 10;
printf("2\n");
a.foo();
printf("3\n");
}
D:\D\src\build\temp>dmd bug3.d bug3m.d
D:\d\dmd\bin\..\..\dm\bin\link.exe bug3+bug3m,,,user32+kernel32/noi;
D:\D\src\build\temp>bug3
1
2
10
3
So.. private means nothing in structs?
If I change the struct to a class I get
D:\D\src\build\temp>dmd bug3.d bug3m.d
bug3m.d(6): class A member b is not accessible
bug3m.d(8): class A member foo is not accessible
which is much better.
If I also move the class definition into the same file as main I get:
D:\D\src\build\temp>dmd bug3m.d
D:\d\dmd\bin\..\..\dm\bin\link.exe bug3m,,,user32+kernel32/noi;
D:\D\src\build\temp>bug3m
1
Error: Access Violation
So.. when the class is in the same module private does not block access
but causes an access violation instead.
Regan.
OTOH, that *does* block access to it (at runtime anyhow) ;-)
--
Derek
Melbourne, Australia
Jun 26 2004
On Sun, 27 Jun 2004 17:32:20 +1200, Regan Heath <regan netwin.co.nz> wrote:--[bug.d]-- module bug3; struct A { private int b; private void foo() { printf("%d\n",b); } } --[bug3m.d]-- import bug3; void main() { A a; printf("1\n"); a.b = 10; printf("2\n"); a.foo(); printf("3\n"); } D:\D\src\build\temp>dmd bug3.d bug3m.d D:\d\dmd\bin\..\..\dm\bin\link.exe bug3+bug3m,,,user32+kernel32/noi; D:\D\src\build\temp>bug3 1 2 10 3 So.. private means nothing in structs?Behaviour is unchanged as of v0.94 - bad/bug.If I change the struct to a class I get D:\D\src\build\temp>dmd bug3.d bug3m.d bug3m.d(6): class A member b is not accessible bug3m.d(8): class A member foo is not accessible which is much better.Behaviour is unchanged as of v0.94 - good/expected.If I also move the class definition into the same file as main I get: D:\D\src\build\temp>dmd bug3m.d D:\d\dmd\bin\..\..\dm\bin\link.exe bug3m,,,user32+kernel32/noi; D:\D\src\build\temp>bug3m 1 Error: Access Violation So.. when the class is in the same module private does not block access but causes an access violation instead.Behaviour is unchanged as of v0.94 - bad/bug. Regan. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jun 27 2004









Derek <derek psyc.ward> 