4 ms·
Could be, now that you mention it. Which, now, makes me wonder if my K&R is even shorter.
by vonwoodson 4y ago
Could be, now that you mention it.
Which, now, makes me wonder if my K&R is even shorter.
- zh3 4y agoJust checked my first edition K&R (copyright date 1978, last page number is 228 (end of index) after which there is a single tearout page for other "High Quality C and Unix system titles" from Prentice Hall. There's also a front section that has about 10 pages in roman numerals (2 pages of prefix starting with 'ix') so about 240 pages total. Page 1 starts: "Chapter 0: Introduction".
- checkyoursudo 4y agoPage 1? What, it's not zero indexed?
- DonHopkins 4y agoIt looks like it's 1-indexed, but it core dumps when you get to the last page.
- DonHopkins 4y agoThere's one thing that's usually true about every well used copy of K&R, and that's that it always opens up easily and by default to the page with the huge operator precedence order and associativity table, because that's the page everyone needs to refer to the most often, which is usually bookmarked, but in an old copy doesn't even need to be. That says something about the C programming language design, that I as a deeply stack based FORTH programmer and explicitly parenthetical LISP programmer find horrible.
- dahfizz 4y agoJust use parentheses if you're doing many operations on one line? This is common sense in any programming language. I've been programming in C for years and never had an issue with operator precedence.
- falcrist 4y agoThere's a lot of exaggeration that goes on with certain fans of postfix systems when they talk about infix systems. For example: I really like HP calculators, so I'm in several facebook groups for fans of RPN/RPL and HP specifically. Sometimes a few of them go way too far out of their way to try to demonstrate how inferior algebraic systems must be. For the record, my copy of K&R wants to open into either section 7.6 or appendix B. No idea what this says about me, though.
- michaelcampbell 4y agoIndeed, different strokes for different uses. I "grokked" RPN pretty early in my career and use it for all my calculator stuff... only. infix for programming languages is equally comfortable for me. I still have to think and study quite hard the prefix LISP notation. I get it, it's just not internalized like the other 2.
- DonHopkins 4y agoIt's not that YOU have any issues with it -- because you're perfect. https://www.youtube.com/watch?v=fKHaNIEa6kA https://www.youtube.com/watch?v=fKHaNIEa6kA It's about the poor people who read your code that relies on both you and them having perfectly memorized every single little detail of operator precedence and associativity, instead of simply and consistently using parenthesis. Quick without looking: can you tell me what the precedence and associativity of the ternary ?: operator is? The designer of PHP got it wrong (which isn't surprising given his proudly self proclaimed contempt towards computer science and incompetence at parser writing), but then millions of PHP programmers also learned it the wrong way. https://en.wikiquote.org/wiki/Rasmus_Lerdorf https://en.wikiquote.org/wiki/Rasmus_Lerdorf Do you really want any of those people who were corrupted by PHP messing around with your code, if you relied on it being one way, and they assume it works the other way? It's not that you can't tell what it actually does, it's that you can't tell what the person who wrote it actually meant, which is more important than what it actually does, especially when it has bugs. Don't do many operations on one line, AND do use parenthesis, AND do use indentation, with no exceptions except for very simple expressions. Take every opportunity to use line breaks and vertical alignment to make symmetry and repetition and nesting visually obvious, like: float distance = sqrt( (x * x) + (y * y)) Redundant parens, plus breaking expressions into multiple lines and indenting according to depth, unambiguously express programmer INTENT, so the reader doesn't need to wonder if the person who wrote it had a clue or was just showboating. Just use parenthesis, and put a comment on it, sailor. https://wellcomecollection.org/works/m33njwx3/items https://wellcomecollection.org/works/m33njwx3/items My copy of The Little Schemer won't open to page 13 because of the jelly stains. https://vpb.smallyu.net/[Type]%20books/The%20Little%20Schemer.pdf https://vpb.smallyu.net/[Type]%20books/The%20Little%20Scheme...
- belter 4y agoCan I up vote for first paragraph, and down vote the second? :-)
- benj111 4y agoIsn't that what brackets are for? Well that's what I do. If you're having to look it up to write it, you're going to have to look it up to read it again down the line.