Live data from Hacker News

Why I Chose to Learn C

viget.com

41–50 of 78 posts

Re: Why I Chose to Learn C

#41
post #34

Earlier quoted context omitted.

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?

Of course, I did not say assembly is just like Lisp in every respect. But as long as we're picking nits -- It is of course completely possible to create executable code during runtime, using assembler. Often not advisable. (Recall the punch line of: http://www.cs.utah.edu/~elb/folklore/mel.html )

Reading the story on the link made me feel envy :)

I admire those who really understand how it all works under the hoods.

Although I tried to learn assembly on my own a long time ago, I never went much further than reading some imput and printing it to the screen. It seems it is a very specialized knowledge nowdays.

Re: Why I Chose to Learn C

#42
post #35

For those who hit a wall with C when it came time to learn pointers, I'd like to plug a YouTube video I made that people seem to really like. https://www.youtube.com/watch?v=IkyWCOUY8V4 The terminology may not be completely accurate (although I did try very hard to not say anything incorrect), but I honestly think it does a good job of showing you how to actually use pointers. I know the resident C experts will proba…

Pretty good, I prefer Binky myself (http://www.youtube.com/watch?v=f-pJlnpkLp0), but to each their own.

Re: Why I Chose to Learn C

#43
post #35

For those who hit a wall with C when it came time to learn pointers, I'd like to plug a YouTube video I made that people seem to really like. https://www.youtube.com/watch?v=IkyWCOUY8V4 The terminology may not be completely accurate (although I did try very hard to not say anything incorrect), but I honestly think it does a good job of showing you how to actually use pointers. I know the resident C experts will proba…

I have never understood what was so confusing about the concept of pointers. What I can see as confusing though is the way C's syntax works with declaring multiple levels of pointer indirection with arrays mixed in, although that can be mitigated with the use of typedefs.

Re: Why I Chose to Learn C

#44

Earlier quoted context omitted.

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.

To be clear, even on architectures that allow it (or OS environments: the NX bit on modern x86 boxes means that you can't write to code space without mmap'ing the region yourself), it's a Very Bad Idea. Code and data use different L1 caches (on Sandy/Ivy Bridge, there's even a still lower level "uop" cache for code!), and keeping them coherent after self-modifying code has run is (1) extraordinarily difficult to get right and (2) hugely slow, much slower than simply indirecting on data in the first place.

Re: Why I Chose to Learn C

#45
post #35

For those who hit a wall with C when it came time to learn pointers, I'd like to plug a YouTube video I made that people seem to really like. https://www.youtube.com/watch?v=IkyWCOUY8V4 The terminology may not be completely accurate (although I did try very hard to not say anything incorrect), but I honestly think it does a good job of showing you how to actually use pointers. I know the resident C experts will proba…

I never really got why people found pointers to be complicated. I suck at writing C code, but pointers are something I understood pretty easily. It in the name really, it's something that points to (the location of) something else.

I doubt that anyone struggles to understand pointers, they/we struggle to understand the implementation of pointers in C, in some cases. If you want to explain pointers, to people from a object oriented programming background, you might start by comparing points to "by reference" and "by value".

My issue has always be why I would care about the memory address of a variable, rather than getting the value as the default behavior, but that might be why I suck a C.

Re: Why I Chose to Learn C

#46
post #35

For those who hit a wall with C when it came time to learn pointers, I'd like to plug a YouTube video I made that people seem to really like. https://www.youtube.com/watch?v=IkyWCOUY8V4 The terminology may not be completely accurate (although I did try very hard to not say anything incorrect), but I honestly think it does a good job of showing you how to actually use pointers. I know the resident C experts will proba…

I have never understood what was so confusing about the concept of pointers. What I can see as confusing though is the way C's syntax works with declaring multiple levels of pointer indirection with arrays mixed in, although that can be mitigated with the use of typedefs.

Pointers to stack objects?

Re: Why I Chose to Learn C

#47
post #40
post #23

Earlier quoted context omitted.

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…

That's strange, I've never had a problem with Wacom on Ubuntu

I have 28" monitors, so I had to do some command line configuration to make the tablet respond. It may feel like the appropriate sensitivity out of the box on a smaller screen. There was also no GUI configuration last time I checked.

Re: Why I Chose to Learn C

#48
post #9

C programming is still alive and well is many parts of our profession. The biggest reason why is that even though c++ _can_ do memory management like C most of the time programs implemented in it don't and you can really start to loose a grasp as to what your asking the computer to do when you abstract away where your putting all the stuff your unknowingly asking it to make.

In the other hand, I find that C++'s ability to add semantics to memory management is extremely valuable in doing the right thing at all times.

unique_ptr, scoped_ptr, and shared_ptr all say different things about heap memory lifetime, and those make it easier to maintain your grasp on what you're asking the computer to do.

Like many things in C++, you can do that in C too (e.g. by using a variant of Hungarian notation). But the important thing is to do it.

Re: Why I Chose to Learn C

#49
post #35

For those who hit a wall with C when it came time to learn pointers, I'd like to plug a YouTube video I made that people seem to really like. https://www.youtube.com/watch?v=IkyWCOUY8V4 The terminology may not be completely accurate (although I did try very hard to not say anything incorrect), but I honestly think it does a good job of showing you how to actually use pointers. I know the resident C experts will proba…

I never really got why people found pointers to be complicated. I suck at writing C code, but pointers are something I understood pretty easily. It in the name really, it's something that points to (the location of) something else. I doubt that anyone struggles to understand pointers, they/we struggle to understand the implementation of pointers in C, in some cases. If you want to explain pointers, to people from a o…

Just because you understood it great the first time doesn't mean everyone is like you. I was turned off to C for a long time due to how awful my teachers were at explaining the concept. My first time being exposed to pointers was in a binary tree traversing algorithm handout given out by my teacher - it was just way too much at once.

Re: Why I Chose to Learn C

#50
post #35

For those who hit a wall with C when it came time to learn pointers, I'd like to plug a YouTube video I made that people seem to really like. https://www.youtube.com/watch?v=IkyWCOUY8V4 The terminology may not be completely accurate (although I did try very hard to not say anything incorrect), but I honestly think it does a good job of showing you how to actually use pointers. I know the resident C experts will proba…

I have never understood what was so confusing about the concept of pointers. What I can see as confusing though is the way C's syntax works with declaring multiple levels of pointer indirection with arrays mixed in, although that can be mitigated with the use of typedefs.

You may be surprised how much a bad professor or tutorial can derail someone. Almost all concepts seems "obvious" or, HN's favorite word, "trivial" once you know it! But getting to the "a-ha" moment can take varying amounts of time depending on the quality of the presentation of the material.
Post reply on HN