Learn C The Hard Way
91–100 of 260 posts
Re: Learn C The Hard Way
#92Ohloh says I've changed at least half million lines of C code ( https://www.ohloh.net/accounts/rhp/positions/total ) Play me a tiny violin ;-) What kinda bugs me is that whenever people go to teach C, they make out like it _has_ to be a low-level exercise, as if writing in C suddenly means you can't use abstract data types or object-oriented style or name your functions properly or have Unicode support. For example,…
The Linux kernel, weird requirements and all, actually represents an excellent example of using C well. It has high-level functions, objects, classes, abstract data types, interfaces, and many other useful abstractions to make C almost comfortable.
Re: Learn C The Hard Way
#93Ohloh says I've changed at least half million lines of C code ( https://www.ohloh.net/accounts/rhp/positions/total ) Play me a tiny violin ;-) What kinda bugs me is that whenever people go to teach C, they make out like it _has_ to be a low-level exercise, as if writing in C suddenly means you can't use abstract data types or object-oriented style or name your functions properly or have Unicode support. For example,…
C shouldn't be used for anything other than low level programming these days. There are other higher level programming language that would make your job a whole lot easier. Some programmers, like me, are stuck maintaining legacy C application code, but I wouldn't wish that fate for new programmers looking to learn C as another tool in the belt.
I certainly agree that C is most appropriate when you are "low in the stack," just above the operating system and maybe implementing something like a virtual machine. I don't make a habit of writing stuff in C for no reason and the vast majority of programming these days isn't and shouldn't be in C (or C++ for that matter).
However, "low in the stack" is different from "low level" like "I refuse to use modern practices" or "I get to omit half the letters from my function names." You can be coding an on-the-metal kind of thing and still think about it in a high level way.
Re: Learn C The Hard Way
#94Do people really think C is some mysterious, inscrutable language? "To many programmers, this makes C scary and evil." Is this actually true for people? I find C code generally very easy and straightforward to understand; there's not any magic behind the scenes, like there is in any language that's more "high level" than C.
> Do people really think C is some mysterious, inscrutable language? Yes, I do. But it's not because of the language itself. It's trying to figure out what you can do with it after you grasp the fundamentals. I taught myself C using K&R a long time ago, but I never did anything with it. At the time I figured there were two paths I could progress along - UI related (e.g., a Windows app) or systems related (something U…
Re: Learn C The Hard Way
#95Earlier quoted context omitted.
C shouldn't be used for anything other than low level programming these days. There are other higher level programming language that would make your job a whole lot easier. Some programmers, like me, are stuck maintaining legacy C application code, but I wouldn't wish that fate for new programmers looking to learn C as another tool in the belt.
Maybe "low level" is a bit ambiguous. I certainly agree that C is most appropriate when you are "low in the stack," just above the operating system and maybe implementing something like a virtual machine. I don't make a habit of writing stuff in C for no reason and the vast majority of programming these days isn't and shouldn't be in C (or C++ for that matter). However, "low in the stack" is different from "low level…
Re: Learn C The Hard Way
#96Earlier quoted context omitted.
As a teaching assistant for a class ( http://www.cs.cmu.edu/~410/ ) where students write a whole lot of code in C, please introduce the address-of (&) operator and explain how to obtain pointers without using malloc(). Do this before the concept of the heap is ever introduced at all. Be careful when explaining the compiler and how a program actually runs. I've found that a lot of student problems come from "the compi…
I find it is much more helpful, when teaching C, to avoid the word 'address', and call (&) the pointer-to operator. Thinking of pointers as numbers (which the address-analogy does) tends to be harmful for newer C programmers because they want to treat them like numbers.
Re: Learn C The Hard Way
#97Earlier quoted context omitted.
> it's not going to rape your family, it'll just crash Well, if it hits undefined behavior it could in fact rape your family, the standard allows for that.
Oh right, I forgot they added that to the C6.283185307179586 standard.
Re: Learn C The Hard Way
#98Re: Learn C The Hard Way
#99Zed, your level of productivity is truly inspiring. The best of luck to you.
Re: Learn C The Hard Way
#100Isn't "C For Programmers" essentially "HOWTO Use Pointers"? Is there another really complicated idea that C has which most of its heirs do not have?
Strings, and why strlen(s) != the number of letters in a string (UTF-8). Why a string must end with a 0 byte. Binary shifting numbers, especially signed numbers. Memory management; it's fun for the whole family, and more than just knowing how to allocate memory and store a pointer to it. Some other points that I'm sure I'm missing.
Unless it's a pstring or you're working with assembly, other language, etc.
But yes there is a lot to learn with C you don't necessarily get with higher level languages in most cases.