3 ms·
You can also have some kind of heapify/free, with undefined behavior if you get it wrong. I think the C standards committee needs to figure out memory safety b
by ori_b 1y ago
You can also have some kind of heapify/free, with undefined behavior if you get it wrong.
I think the C standards committee needs to figure out memory safety before adding any new features that are likely to interact with it.
- PaulHoule 1y agoSo you're saying the runtime mallocs the pointer to the closure and it's your responsibility to free it when you don't need it anymore?
- ori_b 1y agoKinda. Here's an example: void mkclosure(int x) { int x; void fn(void){ return x + 1; } return fnheapify(fn); } void useclosure(void) { void (^fn)(void) = mkclosure(42); fn(); fnfree(fn); }