Live data from Hacker News

Why I Chose to Learn C

viget.com

21–30 of 78 posts

Re: Why I Chose to Learn C

#21
post #4

C really is fantastic language to learn. When I learned it, I also came from the scripting language world (Python, PHP). Having that as a base, then learning C, lead to revelations about how those scripting languages are created, and how the data structures I took for granted in a scripting language are actually implemented. From what I understand in formal CS courses, you learn from the bottom up, but learning from…

I went in the other direction and it was enlightening too. I learned how useful hash tables can be, and that a word count algorithm need not be a complicated assignment full of segmentation faults. :-)

I also learned how data structure libraries can be separated from user code (when learning C in class we usually created ad-hoc data structures heavily coupled with the calling code).

Re: Why I Chose to Learn C

#22
post #15

Earlier quoted context omitted.

Indeed, given the option, you may not write C++ code at all!

I used to be super into using Boost, etc. I found that it became really unmaintainable (though compiler errors might be better now). My personal style is basically C with STL containers.

> My personal style is basically C with STL containers.

I come from a C background and recently started using C++. This is also my personal style.

Re: Why I Chose to Learn C

#23

Quote below from Learning C the Hard Way " For Windows users I'll show you how to get a basic Ubuntu Linux system up and running in a virtual machine so that you can still do all of my exercises, but avoid all the painful Windows installation problems. " A bootable Ubuntu USB stick with persistent storage might be easier to get started with? Can be created from a Live CD. Interesting idea.

I dual booted for about a year, and then I used virtual machines instead for the last year. Using virtual machines has been a LOT easier. I use Lubuntu on Virtualbox, and I don't plan on going back.

Things that annoy me about Ubuntu dual boot

* My Wacom tablet is terribly hard to configure on Ubuntu. * Flash support seems to be hit or miss in terms of out of the box functionality. Sometimes it works right when you install chromium, sometimes it doesn't * Windows weird partitioning. Windows will only let you have 1 or 2 of these special types of partitions on your HDD, and I somehow maxed out that partition count and couldn't fix it. It was very difficult to work with.

Re: Why I Chose to Learn C

#24
post #15

Earlier quoted context omitted.

I used to be super into using Boost, etc. I found that it became really unmaintainable (though compiler errors might be better now). My personal style is basically C with STL containers.

> My personal style is basically C with STL containers. I come from a C background and recently started using C++. This is also my personal style.

C with templates. I think that would be the best compromise for me.

Re: Why I Chose to Learn C

#25
post #17
post #5

Well now I feel old. When I was in high school, CS was a required course for graduation and it was taught in C++ (that being the pedagogical language of the APCS exam). It wasn't even that long ago (late 1990's).

Here's another surprising (but fully understandable) perspective given in the OP: "Function pointers — It was interesting to me to see that such a low-level language contained functional programming concepts." If you started from assembly and worked up, this looks very different, because at that very low level, functions and data look the same too. (Just like Lisp).

To bring it full circle: Clinger's "Lambda: The Ultimate Label" (http://3e8.org/pub/scheme/doc/lisp-pointers/v7i3/p128-clinge...), in connection with Steele's "Lambda: The Ultimate Goto" (http://repository.readscheme.org/ftp/papers/ai-lab-pubs/AIM-...)

The punchline: "Since calls to known procedures are just gotos that pass arguments, lifted lambda expressions are just assembly language labels that have been augmented by a list of symbolic names for the registers that are live at that label."

Re: Why I Chose to Learn C

#26
post #17
post #5

Well now I feel old. When I was in high school, CS was a required course for graduation and it was taught in C++ (that being the pedagogical language of the APCS exam). It wasn't even that long ago (late 1990's).

Here's another surprising (but fully understandable) perspective given in the OP: "Function pointers — It was interesting to me to see that such a low-level language contained functional programming concepts." If you started from assembly and worked up, this looks very different, because at that very low level, functions and data look the same too. (Just like Lisp).

How is that assembly has code as data just like Lisp? Is it possible to create executable code during runtime, change the language's syntax, and stuff like that, using assembly?

Re: Why I Chose to Learn C

#27
post #23

Quote below from Learning C the Hard Way " For Windows users I'll show you how to get a basic Ubuntu Linux system up and running in a virtual machine so that you can still do all of my exercises, but avoid all the painful Windows installation problems. " A bootable Ubuntu USB stick with persistent storage might be easier to get started with? Can be created from a Live CD. Interesting idea.

I dual booted for about a year, and then I used virtual machines instead for the last year. Using virtual machines has been a LOT easier. I use Lubuntu on Virtualbox, and I don't plan on going back. Things that annoy me about Ubuntu dual boot * My Wacom tablet is terribly hard to configure on Ubuntu. * Flash support seems to be hit or miss in terms of out of the box functionality. Sometimes it works right when you in…

Whatever works with your hardware and use cases!

I was thinking more of a group of people meeting to work through the Learn C the hard way book, perhaps in a coffee bar or something, bringing their own laptops. A bootable stick might make a C environment more accessible to them.

The puredyne project produced a bootable linux specifically to provide a common environment for training in audio production. Seemed to work for them.

Re: Why I Chose to Learn C

#28
post #4

C really is fantastic language to learn. When I learned it, I also came from the scripting language world (Python, PHP). Having that as a base, then learning C, lead to revelations about how those scripting languages are created, and how the data structures I took for granted in a scripting language are actually implemented. From what I understand in formal CS courses, you learn from the bottom up, but learning from…

I too started with scripting languages, and also learn in a similar way. Hearing the value that learning C provided you makes the decision to learn it myself a simple one.

To those versed in C, is the tutorial linked in the original article a recommended one?

Re: Why I Chose to Learn C

#29

I know learning C might seem a bit of a waste of time, but given Obj-C, C++, Python and Ruby can leverage it for performance it's not a bad thing to learn.

Objective C and C++ can leverage it for performance? Objective-C is a strict superset of C and C++ a near superset. If you learnt Objective C or C++ properly, you already know C (!).

While your statement is technically correct, in practice C is a very different beast from C++/Obj-C. For example, in C dealing with global state is a important problem, while one would just encapsulate the state in a object in C++. So someone who learns just one of the supersets can easily miss all the details which the additional features of C++/Obj-C hide.

Re: Why I Chose to Learn C

#30
post #17

Earlier quoted context omitted.

Here's another surprising (but fully understandable) perspective given in the OP: "Function pointers — It was interesting to me to see that such a low-level language contained functional programming concepts." If you started from assembly and worked up, this looks very different, because at that very low level, functions and data look the same too. (Just like Lisp).

How is that assembly has code as data just like Lisp? Is it possible to create executable code during runtime, change the language's syntax, and stuff like that, using assembly?

If your architecture allows it, sure.

I was reading some old Apple II assembly last year, and one very common way to do loops is like this:

1. Is 10 equal to 0?

2. If so, go to step 6.

3. Do a bunch of stuff.

4. Decrement the first number written in step 1.

5. Go to step 1.

6. Rest of program.

Post reply on HN