Re (3): [Oberon] n-o trap analysis confuses me

edgar at edgar at
Sun Mar 28 15:53:23 CEST 2004

> Edgar wrote:
> > Nope. C is on the stack not on the heap => No initialisation before use.
> Can you elaborate a little Edgar.
In Oberon there are RECORDS (Aka structs in C). If a you have a RECORD variable
in a procedure space is allocated on the stack and you can at once work with it.
You will never get a Trap -14 with a RECORD variable. (Like the 'C' message record
Chris wondered about)
OTOH there are POINTER variables which can point to NIL (Nothing)
To be able to work with them you either have to assign another POINTER variable
to them or you have to allocate memory for them with NEW(<pointer variable>).
And if you are in very bad luck the space on your heap is already used up, the
garbage collector also doesn't help. So you get probably your variable back
pointing at NIL.
And when you try to access it BANG: Trap -14 !
I hope this isn't too detailed. But you asked for it :-)

Cheers, Edgar

More information about the Oberon mailing list