if there are any buffer overflows, integer overflows, off-by-one's, signedness issues, failure to check return values of everything, use of typically insecure things like sprintf instead of snprintf, all of these problems will just carry over into your readers' code. please do us all a favor and stress the importance of writing secure code from the ground up and not as an afterthought or something only done just before releasing it.
What do you want to see in Learn C The Hard Way?
21–30 of 127 posts
Re: What do you want to see in Learn C The Hard Way?
#22Re: What do you want to see in Learn C The Hard Way?
#23whatever you do, make your examples bulletproof. even if it's not how you would normally write the code and it seems overly cautious, do your audience a favor and write the example that way anyway. if there are any buffer overflows, integer overflows, off-by-one's, signedness issues, failure to check return values of everything, use of typically insecure things like sprintf instead of snprintf, all of these problems…
I can reinforce each lesson/problem you're describing one by one through the exercises, but a new person simply wouldn't know good code if it slapped them in the face.
Confer with Learn Python the Hard Way to get a feel for the aesthetic and technique I'm working towards.
I don't want to write bulletproof code, I want to teach them how and why to write bulletproof code.
I'm not qualified to meet that kind of lofty standard anyway.
Re: What do you want to see in Learn C The Hard Way?
#24Re: What do you want to see in Learn C The Hard Way?
#25What I really miss is some C book that teaches the modern approach to "object-oriented" C (as done in Gtk, Apache, CPython etc.). Actually many programmers (presumably with only passing knowledge of C programming) even actively proclaim that you cannot program in C in this style.
My approach is going to be relatively unflavored by the Macro Hell of other projects. I'd rather not instill those habits. They can learn that on their own time.
I want the learner prepared to write clean sysprog code. That's it, the rest they can learn having been taught proper C and make their own stylistic decisions.
Re: What do you want to see in Learn C The Hard Way?
#26In the context of writing a driver, you will have to cover concurrency, multi-threading, semaphores/mutexes, function pointers (callbacks), memory management, etc.
One personal side note, would be nice if you integrate TTD into the projects. The number of C developers that I deal with who do not understand the concept of a unit test is amazing.
Also, please cover C99 and talk a little about compilers, linkers and assemblers. You can concentrate only on one binary format (doesn't matter which one) as long as you explain a little bit about how your C code gets converted into machine format and what does that mean.
I would ask myself: "What makes my book on C different from all the other ones?"
Why should I spend my time on reading your book instead of any number of other tutorials or K&R?
EDIT:
Forgot to add, please provide a public repository for your code examples and start using something like Git right away. That's one thing I really enjoy from all the Rails books, they push you into using an RCS immediately.
Re: What do you want to see in Learn C The Hard Way?
#27What I really miss is some C book that teaches the modern approach to "object-oriented" C (as done in Gtk, Apache, CPython etc.). Actually many programmers (presumably with only passing knowledge of C programming) even actively proclaim that you cannot program in C in this style.
Re: What do you want to see in Learn C The Hard Way?
#28Honestly the closer you stay to the spirit of K&R the better the site would be. I've looked at a lot of C books over the years and K&R is the only one I thought was even decent.
I'm not trying to replace K&R, but I'll be inspired by it since I grew up with it.
I grew up as a programmer reading it too so I appreciate what you're saying.
Re: What do you want to see in Learn C The Hard Way?
#29Earlier quoted context omitted.
I'm doing this book precisely because programmers who already know a language aren't ever getting around to learning systems programming or how things work.
I hear you, I voted a few days ago for the C book and this is why I did (and I'm primarily a Python guy).
I'm a professional python dev :)
Re: What do you want to see in Learn C The Hard Way?
#30whatever you do, make your examples bulletproof. even if it's not how you would normally write the code and it seems overly cautious, do your audience a favor and write the example that way anyway. if there are any buffer overflows, integer overflows, off-by-one's, signedness issues, failure to check return values of everything, use of typically insecure things like sprintf instead of snprintf, all of these problems…
It would be nice to provide links to articles and books on why one should use snprintf instead of sprintf or what is integer overflow and how do you deal with it and other topics for writing secure code.
However, as a beginner, it will simply not register since I'm more worried about having used a period instead of an arrow to access a struct member.
Perhaps, instead of writing a beginner C book, an advanced C book is needed more.