Feed Sign in with OpenID OpenID

Simon Willison’s Weblog

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.

Salvatore Sanfilippo

Tagged , ,

25 comments

  1. 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.

    David - 18th December 2009 17:54 - #

  2. Well, there are a bunch of C "standard libraries" including GLib, NSPR, Core Foundation and more. They tend to include (often portable) implementations of IO, networking, data structures, threading, etc - everything that you get from the base class libraries of most high level languages. Most large scale C projects are either built on a library like this or end up spawning one. We've come a long way since K&R.

    Ian McKellar - 18th December 2009 18:42 - #

  3. Don't forget the Apache Portable Runtime, either. :)

    Salvatore == antirez == redis creator, by the way.

    Jeremy Dunck - 18th December 2009 23:16 - #

  4. 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.

    Kai Hendry - 19th December 2009 22:11 - #

  5. 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 - #

  6. What a joy to find someone else who tihnks this way.

    Maryland - 10th October 2011 02:13 - #

  7. I will recommend my friends to read this. Bottes UGGI am quite sure they will UGG Pas Cher learn lots of new stuff here than anybody else!

    bottes ugg - 28th October 2011 03:05 - #

  8. Just an amazing post so far, I was looking for the post since for a while Auto insurance quotes

    Herry - 11th December 2011 19:08 - #

  9. It's quite an interesting and amazing post. Keep up your work and all. I have bookmarked. Looking for a vacation booking ? Choose a beach vacation resort from my guide.

    Mathewdana - 3rd January 2012 06:36 - #

  10. I am exploring this subject as part of a report I need to do on possible careers I might choose.funny jokes Thank you for your post it has valuable information on this topic.

    sNatositesso - 29th January 2012 18:05 - #

  11. It's an interesting experience. Thanks for sharing, i enjoyed to read from your blog. vacation in Alps | home rentals in Whistler

    Suedallin - 12th March 2012 07:55 - #

  12. I really liked your blog quite informative and interesting facts and figures you have discussed on your blog even the comments are very fruitful and helpful in enhancing the knowledge regarding the topic. cell phone spy software

    lafra manit - 21st March 2012 06:10 - #

  13. I impressed with this post. I rarely found this. I came across this and interesting stuff is present here.I will bookmark your website and share with my friends.. cell phone spyware

    johnas loffer - 21st March 2012 07:49 - #

  14. Great article you have here. Environment law

    Intjur - 21st March 2012 09:59 - #

  15. If that's real I could not understand why i find it out just now. Choose to spend your holidays in Alps with your family and rent villa online from travel guide.

    MatildaMayers - 26th March 2012 11:38 - #

  16. Find financial adviser

    ross - 3rd April 2012 10:37 - #

  17. Hi. 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. Samedis - Scientific Journal.

    Anna - 5th April 2012 08:56 - #

  18. your post is really good!

    Coach Outlet - 28th April 2012 03:18 - #

  19. Do you heard about online surveys? It's a great way to make money from home. For more info check out surveys for money it's a site with survey top list

    Troy - 4th May 2012 07:59 - #

  20. It definitely stretches the limits with the mind when you go through noise acceptable activity and act an travail to understand it unobjectionable.

    best home décor - 8th May 2012 09:40 - #

  21. This is possible consultatory and multipurpose for me. I was in act of inexpiable locating of progaram from net whatsoever recounting. At involute I magnet it. Thanks alot Mouse Traps

    jgurma - 21st May 2012 10:10 - #

  22. Great article ,thanks for sharing it.
    imchemist.hubpages.com/hub/WellbutrinSideEffects

    mido bedo - 22nd May 2012 02:28 - #

  23. I am so glad I came across this post.used car values

    kumar - 23rd May 2012 13:34 - #

  24. It is just that one I was looking for and I can say I have found it. I have always tried to understand this post about but here it is my only solution.make feed or fuel pellets

    rtre - 24th May 2012 08:23 - #

  25. There hit been whatsoever tallish stories of liveness against all tbe ratio and mythical whimsy. But there are communicator stories of monumental inefficiency in the connector of aid. And Get is now out of the see in see of untold stories yet the inform is in dreadful impoverishment of utilise and assets Snow Blower Reviews

    seseliagil - 25th May 2012 07:06 - #

Sign in with OpenID

Auto-HTML: Line breaks are preserved; URLs will be converted in to links.

Manual XHTML: Enter your own, valid XHTML. Allowed tags are a, p, blockquote, ul, ol, li, dl, dt, dd, em, strong, dfn, code, q, samp, kbd, var, cite, abbr, acronym, sub, sup, br, pre

A django site