I think that what’s particularly hard with C is not the details about pointers, automatic memory management, and so forth, but the fact that C is at the same time so low level and so flexible. So basically if you want to create a large project in C you have to build a number of intermediate layers (otherwise the code will be a complete mess full of bugs and 10 times bigger than required). This continue design exercise of creating additional layers is the hard part about C. You have to get very good at understanding when to write a function or not, when to create a layer of abstraction, and when it’s worth to generalize or when it is an overkill.
So true! I understand some people struggle with pointers, etc. but the big difference for me between C and any "higher level languages" is normally the standard library.
Give me C with a library as comprehensive, reliable and consistent as that in .NET (or even Python) and I'm done.
Don't forget the Apache Portable Runtime, either. :)
Salvatore == antirez == redis creator, by the way.
Jeremy Dunck - 18th December 2009 23:16 - #
Unix is built on small C programs like ls, sort, grep, cat etc.
The GNU versions of these utilities are admittedly bloated, though if you look at the plan9 unix port, they are genuinely small readable & reliable programs.
Unix is considered a "large project" and able to solve a variety of problems.
So no you do not have write a long C program to realise a "large project". In fact you should try keep C programs less that 2-3k SLOC.
And layers of abstraction is the wrong way to solve a problem. Good C programs do one thing well and are able to work with other programs with stdin, stderr and stdout, which is really simple.
Have a look at http://suckless.org/ for further well written C projects.
This is exactly how I feel about PHP. Big sites with non-terrible php code bases have many layers of abstraction that together build a cohesive meta-language.
Erik F. Kastner - 30th December 2009 05:23 - #