2 ms·
>If you don't manage your memory precisely, then sure, C is probably not the language for you. I agree with everything above that line and probably the intent
by harry8 6y ago
>If you don't manage your memory precisely, then sure, C is probably not the language for you.
I agree with everything above that line and probably the intent of that line too.
However I'd phrase it as:
If you don't want to be forced to make a large effort managing memory for the given task, C is the wrong tool for that job. Even when you're great with C. Even when C is wonderful for a different job because you do it fabulously well.
I use C and like it. I don't use it when python is good enough for the job because in those situations python is likely to be actually better than C because you'd incur a debt to pay for something you don't need and as a result you just might miss one of those payments. The interest rate on a missed payment can get pretty steep.
Prefer shell, ruby, perl, something jvm, whatever? - Great. Exactly the same point applies.
I'm sure this point does /not/ apply to your comment above but it could be (mis)interepreted that way - C programming macho arrogance is not helpful for good quality software. C macho arrogance is pretty destructive, in fact and IMHO the worst thing about the use C (& C++ etc.)
- GuB-42 6y agoIt was the intent of that line and I totally agree with your comment. C is definitely not the right tool for every job. And in fact, I don't write that much C for that reason, the cognitive load of tracking every bit of memory is high and not always justified. I wouldn't put C and "modern" C++ in the same class though. They are actually very different from a memory management perspective. You can write C++ like you write C, there are plenty of valid use cases for that. However, the "standard" way of doing C++ now implies things like containers, RAII and smart pointers. It means objects get allocated and de-allocated automatically, dangling pointers and buffer overflows are less likely, but it has a cost in terms of performance and control. Another tool for another job.
- harry8 6y agoYeah totally, completely agree. One of the things C and Modern idiomatic C++ (using C++11 on) have in common is some part of the culture surrounding them having a tolerance for, if not liking of, macho arrogance. "If you got burned it's purely because you're stupid and lazy which I am not, ha ha." This kind of vibe. Not everywhere by any means, but it exists and it's destructive to sensible analysis and the writing of good quality software, while alienating some talent from the pool of potential colleagues. I strongly dislike it.