2 ms·
In a way I'm surprised the language standard for C hasn't been extended to have a standardized RAII "hook" concept? I don't think it's that far outside of the
by cmrdporcupine 3y ago
In a way I'm surprised the language standard for C hasn't been extended to have a standardized RAII "hook" concept?
I don't think it's that far outside of the core language philosophy. Though it would take years for it to make it through to all toolchains and actually be adopted.
- layer8 3y agoFor some people, “invisible” function calls are the devil incarnated and against the alleged C philosophy of “what you see is what you get”. Arguably a compromise would be that you still have to write the resource-freeing calls explicitly, but the compiler would verify that you didn’t forget them. On the other hand, that’s what linters could already do.
- duped 3y ago"defer" (1) is probably making it in eventually, but it's not trivial. (1) https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2895.htm https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2895.htm
- pjc50 3y agoPeople have proposed "defer": https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2895.htm https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2895.htm