clarification regarding allocation in `a bad stack`
seaerchin opened this issue · 1 comments
seaerchin commented
Problem
[ptr] -> (Elem A, ptr) -> (Elem B, *null*)
In this layout we now unconditionally heap allocate our nodes. The key difference is the absence of the junk from our first layout. What is this junk? To understand that, we'll need to look at how an enum is laid out in memory.
i'm not entirely sure why the node representation for Elem B
has a *null*
; given that the nodes are required to have a pointer to a List
, shouldn't it be (Elem B, ptr) -> (Empty, junk)
?
seaerchin commented
closing, realised the author was talking about a potential second layout