Re:Ask HN: Learning C
by baguasquirrel on Sunday April 26, 2009 @04:15PM
(#580380)
Indeed, the problem with C is just that. Once you understand how it works, you'll realize it's just a thin abstraction layer over assembly language. It really is just that simple. My last job was almost purely C, and what made C "scary" at times were:
1. naming conventions. I don't know why C programmers use the strange names that they do.
2. macros. C macros are a pain to read and follow.
I hope things will be easier to learn if you know this going in, because that's really all there is to it.
The catch with C is that while it is simple, writing good code with it is not. You have two tools for metaprogramming: macros and function pointers. C++ classes seem evil, until you see what people do in C in the absense of any mechanism for polymorphism.
Thankfully for you, you probably will only ever need to deal with libraries, not applications, so you'll never have to deal with the hell that comes with trying to use C for higher level work.
They use the strange names that they do because a function declared in C is declared everywhere in the whole program. They use strange names to try to stay out of your way; i. e. it would be really bad if two functions had the same name.
Re:Ask HN: Learning C
by Daniel_Newby on Monday April 27, 2009 @04:27AM
(#581055)
You're right that C's lack of namespaces makes for funky names. However, note that "static" functions are visible only within their compilation unit, which can bring some order to the madness.
Re:Ask HN: Learning C
by baguasquirrel on Monday April 27, 2009 @03:05PM
(#581883)
Yes, exactly. And yet people continued to use the unhelpful, oblique prefixes and suffixes they used for global symbols nonetheless.
I don't know what people are using to learn C these days, but the standard has always been the white book http://www.amazon.com/Programming-Language-Prentice-Hall-Sof...
You will find yourself spending more time thinking about programming concepts rather than dealing with C syntax, since it's pretty concise. I don't know how difficult it is to learn about pointers if you have already been programming for a while but haven't had to use references directly, but it's very important to learn. C does not do too much for you on its own, so handling references yourself is an important skill. It will also help you understand how higher level languages and concepts work.
If you are working through it and find that you're enjoying yourself, congratulations, you're a programmer :] Then it's time to pick up the 1st volume of Knuth and start working through that.