Hi Kashyap,

> Another clarification - I was looking at the implementation of consName
> After this assignment, p points to the CDR of the cell -
>    p = symPtr(p);

Correct.


> However, this assignment assigns to ((p)->car)
>    val(p) = n;
> I figured out what's happening is equivalent of *(word*)p = val?:p;

To be exact, 'val(p) = n' is equivalent to '*(word*)p = n'.


> I got a little tripped by the definition of val - because "p" is really not
> a Cell pointer after the symPtr assignment right? I mean, p->cdr is invalid
> at this point correct?

Yes, correct. val(p) can be used both for list cells (where p points to the CAR
of the cell) and for symbol cells (where p points to the CDR of the cell (which
in turn holds the VAL of that symbol)).

Thus, p->cdr points outside of this cell, to the next, not related, cell in the
heap.

- Alex

-- 
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe

Reply via email to