4 ms·
Not a bad summary. Albeit with some odd choices. [EDIT: Reading a little more I'm revising down as summary. There's quite a bit that's amazingly tortuously ex
by oldcynic 8y ago
Not a bad summary. Albeit with some odd choices.
[EDIT: Reading a little more I'm revising down as summary. There's quite a bit that's amazingly tortuously explained, or slightly wrong. e.g. '//' doesn't have to be the first 2 chars of a line, it's anywhere to EOL. He refers to both parentheses and braces as braces! Explanation of needing ';' at EOL is not helping any beginner who;d be better off with the traditional "all C statements end with a ';'".]
Couldn't call it a primer though as it takes an express trip through the features from my first program to pointers to functions in a dozen page downs.
I don't think "downside of function pointers is the added mental load to handle the indirection" rates as enough of a warning, at all. How's about letting our beginners trip up on arrays and pointer arithmetic, in a few example programs, before giving keys to all the self inflicted weaponary?
"void An undefined type, used often to mean no type (no return or no parameters) or if used with pointers, a pointer to “anything”
Undefined? That strikes me as a way for the beginner to get totally the wrong idea.
It's used to indicate no return value or parameters in function definitions. A void pointer is generic - it can be cast implicitly to anything. You can't do pointer operations until it has been cast to a type. It is not undefined.
- _kst_ 8y ago"Explanation of needing ';' at EOL is not helping any beginner who'd be better off with the traditional "all C statements end with a ';'".]" Almost all C statements and declarations end with a semicolon. But compound statements don't.
- oldcynic 8y agoThanks. Missed 'individual'... Mind I'd stick with the K&R approach and refer to compound statements as blocks in a beginner's primer. What I wouldn't do is "explain" in a way that will probably have a beginner rescanning multiple times - I had to do a double take: "Other lines that are not starting a function, ending it or defining control end every statement in C with a ; character"