Live data from Hacker News

Essential C

cslibrary.stanford.edu

31–40 of 57 posts

Re: Essential C

#31
post #7

Any additional recommendations for C tutorials?

When i was about 13 or 14 years old, i read Brian Kerninghan & Dennis Ritchie's "The C Programming Language". This book (by the language creators) is a classic and does an excellent job of explaining the C language. I learnt C by reading that book and experimenting writing code.

It is a very good book and it should be easily available.

Re: Essential C

#32
post #17

Oh, memories. I took CS107 in 1996, which was apparently the date this handout was written. Nick was my academic advisor, and his CS108 (which was C++ at the time) was one of my favorite courses of all time. Bunny World... Maybe I'm just a grumpy old programmer, but I feel like kids these days are missing out on something important by learning to program in a language that doesn't require them to truly grok memory ma…

Show me a Haskell programmer who doesn't understand memory management. You are grumpy, and I am older, but all memory is managed.

I recently ran into someone that was teaching a Python boot camp and they were forcing the students to use VIM instead of PyCharm, and in their words, "using a text editor requires them to memorize apis".

They didn't know about type inference, rename, extract method or navigate to declaration. I view it as the same bias, the attitude doesn't encourage people to use the best tools for the job because we suffered in the past. How about we go back in time and teach young selves how to write code than actually use 2TB of main memory and 128 cores using a dev environment that can scale to millions of lines of code.

Re: Essential C

#33
post #8

I recently started a graduate course that originally required C++. My only exposure to C++ basically went through the fundamentals of the C part without getting to any of the ++. Is there something similar to this for C++? I understand that C++ is a much larger language and I'm definitely not looking for something comprehensive, more of a solid overview of a workable subset of the language. Enough to be productive, p…

Word of advice. Don't learn any of the OOP stuff in C++, many learned it, but later they had to unlearn it. Search for data oriented design.

This looks like the best resource, https://github.com/dbartolini/data-oriented-design

Re: Essential C

#34

Any interesting ideas to try C out on for an experienced programmer?

If you're looking for something quick, then a Brainfuck interpreter shouldn't take longer than an afternoon, and a simple one will be a couple hundred lines. Optimising it though, can be more difficult and is one of those things you can keep working on for ages.

If you're looking for a challenge, a JSON parser is a more involved project, especially if you implement your own HashTable structure for storing things.

If you want something to be proud of at the end, then you could always try your hand at glitch art. Grab an image file, read it, manipulate it, and output it again.

Re: Essential C

#35
post #7

Any additional recommendations for C tutorials?

When i was about 13 or 14 years old, i read Brian Kerninghan & Dennis Ritchie's "The C Programming Language". This book (by the language creators) is a classic and does an excellent job of explaining the C language. I learnt C by reading that book and experimenting writing code. It is a very good book and it should be easily available.

A lot of people love this book, but I kept getting stuck because it seems like half the time it assumes prior programming knowledge. I only made it a few chapters in, but I don't think they do a great job of explaining much of anything to a beginner.

I'm planning on attempting to read it again after I finish Harvard's CS50. Maybe I just need a lot of hand-holding, but this course seems to do a much better job of explaining concepts.

Re: Essential C

#36
post #35

Earlier quoted context omitted.

When i was about 13 or 14 years old, i read Brian Kerninghan & Dennis Ritchie's "The C Programming Language". This book (by the language creators) is a classic and does an excellent job of explaining the C language. I learnt C by reading that book and experimenting writing code. It is a very good book and it should be easily available.

A lot of people love this book, but I kept getting stuck because it seems like half the time it assumes prior programming knowledge. I only made it a few chapters in, but I don't think they do a great job of explaining much of anything to a beginner. I'm planning on attempting to read it again after I finish Harvard's CS50. Maybe I just need a lot of hand-holding, but this course seems to do a much better job of expl…

>but I kept getting stuck because it seems like half the time it assumes prior programming knowledge

Yes, to be honest, C is not good as a "first" programming language. If i can give you a suggestion, it would be: Start learning Python, which is a good "first language to learn", and then try this book.

You will find that jumping from Python to C there will be two strong differences:

a) C is a statically typed language, so you will need to declare (specify) the type of each variable you would like to use.

b) In Python, the language manages your usage of the computer's memory. In C, you manage the memory... After some CS courses you'll probably be familiar with concepts like "linked lists", which then you can try implementing in C by using pointers. Thus, you'll realize that in C you are in control of the computer's memory; you will be able to request (allocate, with malloc) blocks of memory and free them afterwards.

c) C syntax can be tricky, compared to Python.

Re: Essential C

#37

Earlier quoted context omitted.

A lot of code is still written in C89 for maximum portability, and I regularly do that. The only thing I really miss from C99 is the mixed declarations and code, but you can instead use nested scopes or just move the declarations up to the top.

What portability do you need, specifically, beyond C99?

A lot of compilers for embedded systems are still C89 (with a few architecture-specific extensions).

Re: Essential C

#38
post #28

Earlier quoted context omitted.

I don't know if I would count any part of C11 as "essential", particularly given its still-spotty implementation coverage.

You are partly right about the implementation coverage. For a lot of embedded development where you can't cross compile with a modern compiler it's of course an issue. For major desktop and mobile platforms, I don't see an issue. Clang has excellent support for the mandatory parts of C11, it's even the default setting (well GNU C11). Given that one can now configure Clang as the frontend for Visual Studio on Windows,…

Sorry to update you, but Microsoft has dropped that frontend.

They now advise to use clang directly, since its Windows support has been improved.

Re: Essential C

#39
post #8

I recently started a graduate course that originally required C++. My only exposure to C++ basically went through the fundamentals of the C part without getting to any of the ++. Is there something similar to this for C++? I understand that C++ is a much larger language and I'm definitely not looking for something comprehensive, more of a solid overview of a workable subset of the language. Enough to be productive, p…

Word of advice. Don't learn any of the OOP stuff in C++, many learned it, but later they had to unlearn it. Search for data oriented design.

Good advice, why learn something that isn't used on STL, Qt, wxWidgets, boost.
Post reply on HN