From f37ef42cb44e8f2b24de68d51472cc2652637d11 Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Tue, 14 Feb 2023 07:56:52 -0800 Subject: [PATCH] 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? --- implementations/C/joy.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/implementations/C/joy.c b/implementations/C/joy.c index 0064cfe..3bb559b 100644 --- a/implementations/C/joy.c +++ b/implementations/C/joy.c @@ -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); }