On Tuesday, 8 April 2025 at 14:00:56 UTC, Jonathan M Davis wrote:

You basically have to lie to the compiler and cast the function pointer to pure [...].

That being said, core.memory has pureMalloc and pureFree which do that for you already, including mucking around with errno to ensure that it's not changed even though malloc and pure can change it.

Oh, cool. Thank you very much.

That being said, personally, I think that it's a mistake to try to force pure like this [...]. We already have a variety of compiler bugs related to doing stuff based on pure.

- Jonathan M Davis

Yeah, maybe you're right, but I use pure more for myself - it tells me that a function doesn't depend on global state (beside allocation). And indeed, I use it only on small functions where I have the feeling to understand what they're doing...

Reply via email to