Hacker News new | past | comments | ask | show | jobs | submit login

It's all a matter of what you're trying to do. If you have a nice test framework with good coverage and automated build tests running stuff by valgrind, you mitigate the risk of having memory leaks.

Is it worth all the extra effort, when you could just go with a language that does GC at runtime? Sometimes it is, it depends on the use case and it depends on the people.

I've done a project rewrite from C to Java where the Java implementation performed a lot better and consumed less memory than the C one. Some of the performance gain was because I chose better algorithms and limited DB interaction, but some of the gain came from having immutability guarantees whereas the C code would just copy a lot of data structures where immutability was not guaranteed. A lot of time in the C based project was spent doing mallocs and frees and memcpys for nothing. This is poor project design, but poor design happens and Java has some protection agains that due to promoting encapsulation to a greater extent than C by default.

I am 100% certain that if the original project would've been better designed and managed, it would've kicked ass because having it in C would have allowed us to have a smaller memory footprint which would've meant a greater monetary profit in the end for this particular project over time due to system constraints.

What it comes down to is that if you have a good team that understands the required dev proccess of a mid-sized C project and who are profficient enough to implement such a project without doing too much "quick fixin'" it can be worth it. If you're limited by the size and/or competence (everyone can't be a rockstar. I certainly am not) of the team or limited in turnaround time for the product, choosing C will probably not be in your best interest. But having the right people around and if there's a monetary gain in doing things efficiently with the hardware you have then C is still an awesome tool to have in your toolbox.

Most of the time, in the world of SaaS and web based solutions, using C doesn't make a lot of sense except for some bits of core functionality. That's why I like languages with good C bindings. Knowing e.g., Python and C, you really can get the best of both worlds.

IMHO, YMMV, &c

EDIT: inserted some newlines




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: