On 14-5-2022 10:49, Hairy Pixels via fpc-pascal wrote:
Apparently what it does is advance the stack pointer x bytes and return a pointer to the new location so you could probably do that with some assembly. Of course this is dangerous because you can request more memory than exists in the current frame.
But optimizations sometimes eliminate the frame pointer and use the stackpointer directly to index e.g. local vars and params. Also when an exception happens, the stack pointer is not as expected in exception frames (don't know if that really is an issue, but I can image). It would be interesting how C handles this (e.g. exceptions while alloca called in a loop?)
So the only non hacky way is to implement support in the compiler I think. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal