Source
- URL: https://x.com/SergeyLerg/status/1698365089701642504
- Author: Sergey Lerg (@SergeyLerg)
- Posted: 2023-09-03 15:59:26
Branch
1/ @SergeyLerg
@SebAaltonen
I like how Jai solved this. You can return dynamically allocated data just fine because every function has access to a temporary allocator (linear block of reserved heap memory). Most data is short lived and the temporary storage is cleaned at e.g. the end of a game render frame
2/ @SebAaltonen
@SergeyLerg
Yes. That’s how C/C++ based game engines tend to do it as well. You just use linear temp allocator (reset at end of frame). But a stack based temp allocator would be even better here. Even better if integrated to the language. Would be easy to use = would be the default for all.