3 ms·
Your concerns are legitimate, but I wouldn't jump to blaming C here. Yes, this deals with memory management, but the cost presented is not conceptually difficu
by mikegerwitz 11y ago
Your concerns are legitimate, but I wouldn't jump to blaming C here. Yes, this deals with memory management, but the cost presented is not conceptually difficult. We can rephrase this issue in any other context and not raise a C argument---you have some set of resources that need to be closed (file descriptors, database connections, etc), and you forget to close it. I was writing a daemon in Node.js for my employer and during development I noticed that it leaking file descriptors until the kernel killed it. That can happen in any language.
Nothing against the programmer; these things happen. But I wouldn't say because of C in this case.
- dbaupp 11y agoC makes these sort of problems more common and occupy more time/energy/source code than they need to. The language doesn't try to help the programmer with even the most basic of these sort of resource management problems. Most modern languages offer tools to handle some subset of them (e.g. GC for memory in managed languages, or destructors for memory and more in C++/Rust), reducing the burden on the programmer for normal resource life cycles and hopefully making it easier to handle the abnormal cases better. Sure, it's not generally possible for a language to perfectly manage every resource all the time, but this doesn't mean we should just give up and throw away computer assistance in cases when we can have it. C is an important language, but there's no need to look at it through rose-coloured glasses.