Re:What do you want to see in Learn C The Hard Way?
by dfox on Friday November 05, 2010 @01:13PM
(#1873973)
Well, function pointers are only one aspect of this. Suprisingly many experienced C programmers I've met don't know that you can safely cast pointer to struct to pointer to it's first field, which is pretty important trick to achieve reasonable OO (with real inheritance) in C.
Re:What do you want to see in Learn C The Hard Way?
by alnayyir on Friday November 05, 2010 @02:49PM
(#1874342)
I know a line cook that codes C on his free time that would strangle someone who was paid to code that couldn't make a fake object + method calls out of a struct and function pointers.
Re:What do you want to see in Learn C The Hard Way?
by misham on Friday November 05, 2010 @12:34PM
(#1873811)
Why would you shy away from macros? Yes they are ugly, but they are an integral part of C and any system programming will rely quite heavily on macros, whether we like it or not.
If you're going to cover macros, please make sure to explain how they work and the multitude of pitfalls as well as how to deal with them; which is to wrap each macro in parenthesis.
Re:What do you want to see in Learn C The Hard Way?
by alnayyir on Friday November 05, 2010 @12:38PM
(#1873839)
There are as many potential problems with macros as there are grains of sand in Saudi Arabia.
Best not to go there beyond explaining how and why not to, and leave it at that.
Order of operations is an example of something that bites people with macros. (ref/deref + macro has nailed a lot of professionals I know)
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.