[Mono-devel-list] Bug? get accessor self-refers
Burton M. Strauss III
Burton at ntopsupport.com
Mon May 5 09:55:47 EDT 2003
I understand the difficulties of loops of references, but the simplest A->A
case could (and should) be trapped as a special case... it's always better
when the compiler traps the simplest typos...
-----Burton
-----Original Message-----
From: Dietmar Maurer [mailto:dietmar at maurer-it.com]
Sent: Monday, May 05, 2003 6:52 AM
To: Burton M. Strauss III
Cc: mono-devel-list at lists.ximian.com
Subject: Re: [Mono-devel-list] Bug? get accessor self-refers
On Sun, 2003-05-04 at 19:55, Burton M. Strauss III wrote:
>
> public byte P {
> get {
> return P;
> }
> }
> }
>
> class Sample {
> public static void Main() {
> x v = new x(3);
> Console.WriteLine("\tP {0}", v.P );
> }
> }
>
> Seg faults when run. If you change the 'return P' to 'return p',
> which is
> (of course) the correct program, it runs fine. Shouldn't there be a
> better
> trap than an OS segmentation fault?
Your code causes a stack overflow. Unfortunately there is no way to
handle such situation in a clean and OS-independent way. So we decided
to simply use the segmentation fault.
- Dietmar
More information about the Mono-devel-list
mailing list