Note to self...

This bit of code works, but I'm not sure why, or even if it's just an
illusion of working, and here lurks a nasty bug?
This commit is contained in:
Simon Forman 2023-02-14 07:56:52 -08:00
parent 19890e5695
commit f37ef42cb4
1 changed files with 9 additions and 1 deletions

View File

@ -262,7 +262,15 @@ push_thing_in_unit_list(JoyTypePtr term, JoyListPtr expression)
{
JoyList x = EMPTY_LIST;
JoyListPtr xPtr = &x;
push_thing(term, xPtr);
push_thing(term, xPtr); /* TODO: is this some weird error?
you get a pointer x on the stack,
set it to NULL (EMPTY_LIST),
then take x's address and put it in another pointer xPtr,
doens't that leave the tail of the JoyList node created in push_thing
pointing to the x pointer on the C stack in this function?
And doesn't that variable go away when we return?
How and why does this work? Is it an illusion, a bug waiting to bite?
*/
push_quote_onto_expression(*xPtr, expression);
}