On Wednesday, 26 May 2021 at 11:31:31 UTC, Ola Fosheim Grostad
wrote:
On Wednesday, 26 May 2021 at 08:38:29 UTC, Imperatorn wrote:
On Wednesday, 26 May 2021 at 07:34:06 UTC, Ola Fosheim Grøstad
wrote:
On Tuesday, 25 May 2021 at 17:55:17 UTC, Ola Fosheim Grostad
wrote:
Is it possible to use a template to write a "function" that
provides initialized stack allocated memory (alloca)? Maybe
I would have to use mixin?
Nevermind, I've realized that I only need a way to force a
function to be inlined with 100% certainty. Then I can return
a structure holding alloca-allocated memory.
Do you accomplish that with just pragma inline? (for future
reference)
I suspect that LDC allows LLVM to use an external function, but
I dont know for sure. I would have to look over the code it
sends to LLVM... But the beauty of Open Source is that it is
easy to modify LDC!
Anyway, dont do this with C compilers, as they might refuse to
inline functions with alloca to prevent the stack from
exploding...
Very much a low level approach, but fun!
for anyone that would ever use this approach with DMD remember to
*always* use -inline flag otherwise the inline request by
```pragma(inline, true)``` can be ignored and this will result in
a nasty bug