Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to explicitly push/pop to the C return stack?

Tags:

c

stack

gcc

forth

Is there a way to explicitly push/pop data to the C return stack? (Ideally in standard C, but a GCC-only solution would be ok too.)

I'm implementing a Forth in C, on a microcontroller that's very tight on RAM (kbytes, not Mbytes).

I'm allocating RAM for the data stack, but I'm hoping to save some RAM by sharing the Forth return stack with the C return stack, via explicit push/pops.

Can this be done in C?

like image 821
nerdfever.com Avatar asked Nov 07 '22 11:11

nerdfever.com


1 Answers

GCC has a __builtin_return_address function, that's probably the closest you'll get.

like image 180
nemequ Avatar answered Nov 15 '22 04:11

nemequ