4 ms·
defer, as proposed here, isn't a library feature though, it's a part of the core language. I'd like to be able to use it, but if it can ever do a malloc (which
by dzaima 5y ago
defer, as proposed here, isn't a library feature though, it's a part of the core language. I'd like to be able to use it, but if it can ever do a malloc (which is horrifically slow compared to not having one), it's just infeasible.
But I looked through the spec again, and it actually just says that defer outside the top level is implementation-defined, so this is irrelevant anyway.
- gmfawcett 5y agoI admit that I didn't read the actual article. :) I was using "library" in a broad sense, just to mean the runtime code that you didn't have to write yourself.
- dzaima 5y agoC doesn't exactly have "runtime code that you didn't have to write yourself" though. There's libc, but you can easily disable it, and having any form of defer be unavailable then is just bad. Everything else comes from your code, the headers it includes (which don't contain function definitions), and statically linked things.
- gmfawcett 5y agoSure. And just like libc, you could easily disable (by not using) a theoretical libc_defer that provided defer semantics. Kind of like libm, you use it when you need it. This has been a fun conversation, and I really enjoyed chatting with you about this. :) Take care.