|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
D - invariant and Stack Overflow
The following D program will cause a Stack Overflow.
The reason is that the invariant calls a member fuction
of the class which in turn invokes the invariant section.
Should calls to member fuctions be allowed in the invariant
section? If so how can this problem be avoided?
class Foo
{
this()
{
}
public int func()
{
return 2;
}
invariant
{
assert(func() == 2);
}
}
int main(char[][] argv)
{
Foo b = new Foo;
return 1;
}
Dec 22 2002
"Patrick Down" <pat codemoon.com> escreveu na mensagem news:Xns92ECC942BF6E4patcodemooncom 63.105.9.61... Dec 23 2002
|