# The Pain and Glory of C

DevFeed: [The Pain and Glory of C](<https://devfeed.tech/articles/the-pain-and-glory-of-c-33382.md>)

Original publisher: [Read original article](<https://timkellogg.me/blog/2011/11/06/pain-and-glory-of-c>)

Published: 2011-11-06T00:00:00Z

Content type: opinion

Language: en

Sources: [Tim Kellogg](<https://devfeed.tech/sources/tim-kellogg.md>)

Topics: [C](<https://devfeed.tech/topics/c.md>), [C++](<https://devfeed.tech/topics/c-plus-plus.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [C#](<https://devfeed.tech/topics/csharp.md>)

Tags: [arrays](<https://devfeed.tech/tags/arrays.md>), [c](<https://devfeed.tech/tags/c.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [c-sharp](<https://devfeed.tech/tags/c-sharp.md>), [comparison](<https://devfeed.tech/tags/comparison.md>), [gotchas](<https://devfeed.tech/tags/gotchas.md>), [memory-leaks](<https://devfeed.tech/tags/memory-leaks.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [programming](<https://devfeed.tech/tags/programming.md>)

## AI overview

The author reflects on solving programming puzzles in straight C and questions why developers choose it over C++ or C#. The article compares C's small, simple syntax and manual memory management with C++'s newer features and complexity, and discusses perceived C# performance concerns.

## Source excerpt

I don't normally write much C code, but this past week I was fiddling around with it this past week to solve some programming puzzles. When I say C I mean straight C (without the ++ or #). Completely un-object-oriented; just structures, helper functions and malloc/free. It took me 3 days (a total of probably 9 hours) to write a fully functional 250-300 SLOC solution to a puzzle (complete with huge memory leaks). This all brings me to the burning question - who would ever want to write programs in C?C++ has developed over the years. I recently looked at some of the enhancements in C++11 which include the auto keyword (like var in C#), better reference counting "smart pointers", lambdas and closures. Obviously, C++ is developing and progressing. C hasn't had a spec change since 1999, and even then it wasn't exactly dramatic. We still don't have any OO or reference counting pointers.Have you ever tried interfacing with a library in C? It's very cumbersome. You have to read all the documentation and call the right my_library_object_*() functions at the right times. Everything is hands-on, nothing is left to imagination. You have to remember what memory you allocated so you can free it sometime later when you're sure you don't need it anymore (and then recursively free sub-structures and arrays).I think anyone can see warts in C. But its easy to forget the simplistic beauty. I mean, there aren't many operators in C, and there's only one way to cast. I mean, sure, you still can't create & initialize a counter variable inline in a for-loop. But the complex syntax of C++ is scary in comparison with all it's member::accessors, template, 5-6 ways to cast a variable and a slew of gotchas. Sure, C has it's share of gotchas, but the language is so small that anyone who's spent any significant time programming C can list most of them out for you (probably not so true with C++).So why not C#? Well, it's freaking slow!! Think about when people were converting their business apps fr