[Mono-devel-list] Bug? get accessor self-refers

Dietmar Maurer dietmar at maurer-it.com
Mon May 5 07:52:07 EDT 2003


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