C yes, C++ no. Make sure you're using a C compiler, not a C++ compiler Here is why not C++: http://news.ycombinator.com/item?id=1463592 and why not java Edit: Was there something wrong with my comment? Or were you downvoting merely because you disagree?
Ask HN: Should I learn C?
71–80 of 98 posts
Re: Ask HN: Should I learn C?
#72Yes, you should learn C. And enough assembly language to understand aspects of how C works, like what a "stack frame" is. Now is a great time to start. Go find K&R, fire up Linux and write and compile "hello, world". Then keep going until you experience your first segmentation fault. ;) (Do not study C++ at this point. Study C. These things turn out to be very very different.)
You, and it seems most others here are suggesting that you learn C by doing some systems programming; I was thinking of dabbling in C, but maybe starting out by doing something with AVR/arduino or something like that.... Is the C your write for embedded stuff fundamentally different from the C you write for linux? I would eventually like to know how to write a php module or something like that, is starting by hacking…
Re: Ask HN: Should I learn C?
#73Yes, you should learn C. And enough assembly language to understand aspects of how C works, like what a "stack frame" is. Now is a great time to start. Go find K&R, fire up Linux and write and compile "hello, world". Then keep going until you experience your first segmentation fault. ;) (Do not study C++ at this point. Study C. These things turn out to be very very different.)
For learning C I strongly recommend C: A Reference Manual (Harbison and Steele), not K&R. Read K&R for context, sure, but Harbison and Steele is more up-to-date and comprehensive while still a concise language reference. That book can basically answer almost any question about the language standard that isn't compiler-specific. http://www.amazon.com/Reference-Manual-Samuel-P-Harbison/dp/...
Re: Ask HN: Should I learn C?
#74I would suggest Python and C, in that order. Python will let you quickly have fun building large applications, and it will teach you object oriented programming. Once you know what a loop is, though, go by "Advanced Programming in the Unix Environment" and a decent C book and trip out on that for a year or so to really understand how computers work. I don't write C for a living at all, but it is great to know how eve…
I just checked Amazon for that book and it looks like you can get used copies of the first edition for under a buck. http://www.amazon.com/gp/offer-listing/0201563177/ref=dp_olp...
1st ed. APUE won't cover e.g. epoll/kqueue at all. Get the 2nd. Fantastic book, though.
Re: Ask HN: Should I learn C?
#75Absolutely yes. There's no downside in learning C, and there's not much fluff in the language core to complicate things, or slow things down. I'd suggest you get a copy of K&R: The C Programming Language and just work through the text and examples. You might also want to pick an existing C-based project and work on bugs in it, maintenance programming being one of the best ways to get to grips with using the key tools…
Re: Ask HN: Should I learn C?
#76Earlier quoted context omitted.
It's also very useful for extending other languages by binding a library.
agreed ... since you seem to be proficient in Python, one potential exercise is to write a C extension to the Python interpreter or C library modules for high performance
Re: Ask HN: Should I learn C?
#77Absolutely yes. There's no downside in learning C, and there's not much fluff in the language core to complicate things, or slow things down. I'd suggest you get a copy of K&R: The C Programming Language and just work through the text and examples. You might also want to pick an existing C-based project and work on bugs in it, maintenance programming being one of the best ways to get to grips with using the key tools…
One downside to learning C is that you will have to resist the temptation to use C on projects where much safer and more productive languages are feasible. Being able to use it speaks well of you, but actually using it is rarely a good decision these days.
Re: Ask HN: Should I learn C?
#78I'm sure there are many reasons to know C/Assembler. But I felt like learning things like why:
obj.getField().setFirst("random"); obj.getField().setSecond("random");
is worse than
Field field = obj.getField(); field.setFirst("random"); field.setSecond("random");
Another reason I used to like C was that it always made me want to make my code run as fast as it was possible to run. When I write code in Java, I'm looking to make the code work. I'm not saying either is better, they just each have their plus points, but I enjoyed C more due it's challenges and feel I'm a much better programmer for knowing it.
Re: Ask HN: Should I learn C?
#79Re: Ask HN: Should I learn C?
#80Yes, you should learn C. And enough assembly language to understand aspects of how C works, like what a "stack frame" is. Now is a great time to start. Go find K&R, fire up Linux and write and compile "hello, world". Then keep going until you experience your first segmentation fault. ;) (Do not study C++ at this point. Study C. These things turn out to be very very different.)
A good book that goes over both C and assembly is "Hacking: The Art of Exploitation". The first 100 pages alone will give you a solid understanding of what is happening behind the code.