Problems with OBJECTs

Fri, 13 Jun 1997 23:59:15 +0800


The program below causes a Segment Violation (SIGSEGV) during compilation
using GPC-970510 for DJGPP 2.01.

{-----------------------------------------------------------------------------}
Type
    PEntry = ^TEntry;
    TEntry = Record
        Prev : PEntry;   { Linked List }
        Data : Word;
    End;

    TObj = Object
        Index : PEntry;

        Procedure DisposeIndex;
    End;
        
Procedure TObj.DisposeIndex;

{$M START}
    Procedure DisposeEntry(Var Entry:PEntry);
{$M STOP}
        Begin
            If (Entry <> Nil) Then
                Begin
                    DisposeEntry(Entry^.Prev);
                    Dispose(Entry);
                    Entry := Nil;
                End;
        End;

    Begin
        DisposeEntry(Index);
    End;

Begin
End.
{-----------------------------------------------------------------------------}

The problem does not occur if the procedure "DisposeIndex" is NOT a method
of an object. If "DisposeIndex" is declared as a normal procedure then the
program compiles OK. WEIRD!?!?

I narrowed the problem down to the definition of the nested procedure
"DisposeEntry". The second {$M} is never displayed.

Tschuess
 ________________________
|  _)        | |             e-mail: bernie@icenet.com.au
|___)ernhard |_|schirren             ptschirrenb@cc.curtin.edu.au
                             www:    www.geocities.com/CollegePark/Quad/8070/


Bernhard Tschirren (bernie@icenet.com.au)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es