5 ms·
C'mon, viewing a book from 1990 with the lens of 2018 must be funny of course; almost nothing in programming languages aged well, baring some theoretical princi
by bitL 8y ago
C'mon, viewing a book from 1990 with the lens of 2018 must be funny of course; almost nothing in programming languages aged well, baring some theoretical principles. Many of the things the book author tried to avoid (like not using integer indexes) were necessary for writing fast code on 4MHz processors with 256kB of RAM in primitive compilers back in the day...
Can you please add some xBase book review to the mix for more outdated fun and facepalming from the heightened point of view on a hill of three decades next? /s
- Xophmeister 8y agoHindsight isn't really in play, here. The examples given are just plain wrong, rather than outmoded.
- bitL 8y agoBack in those days 100 bytes was like a huge string; when you raised your hands that there will be a problem you were told to shut up, that you don't get the efficiency of computing and that you won't see strings longer than 16 characters or similar. This Zeitgeist is completely lost and viewing it with contemporary optics is just funny at best. IIRC most of early hacks on Internet exploited the lack of boundaries in strings and returning pointers on stack, which is something the book author got wrong but given how wide-spread it was, likely most of C programmers were doing it incorrectly. With contemporary optics I'd tend to say: "It's purely fault of C language designers!" but I know better.
- irishsultan 8y agoThis doesn't explain why one would ever want to return a pointer to a local variable.
- blub 8y agoAs mentioned by another commenter, they were probably targeting the Keil C51 compiler which stores local function arguments in fixed memory locations: https://news.ycombinator.com/item?id=17399633 https://news.ycombinator.com/item?id=17399633
- mikeash 8y agoUnless the book states this explicitly and explains that their examples are only good with that compiler and are not actually valid C, that doesn’t really help.
- bitL 8y agoWhy would you assume the book author (if he indeed used Keil C51) would be aware of more dialects and their intricacies? Do you really think that in the early 90s there was a wide-spread rigor in software books? There was no Internet, whatever software one could get was the one that was their "standard", there was very limited knowledge exchange between academia and practitioners etc.
- mikeash 8y agoI’d assume that because he wrote a book about “C”, not about “C targeted for the Keil C51 compiler.” I read plenty of programming books around that time. They were almost always specific to some platform, but they always said so. I never saw, say, a “Pascal” book that turned out to be completely specific to ORCA/Pascal. It would say what it was for.
- mannykannot 8y agoIn the 90's there was at least one good software book: 'The C Programming Language' by messrs. Kernighan and Ritchie - you may have heard of it? It correctly told you, among other things, everything you really need to know about using pointers in C. It is still available.
- bitL 8y agoI was a kid back then; K&R was pretty hard to find in my area and it was quite outdated anyway, most people were happy to use whatever resources they could get; the best in mid-to-late 90s ended up things like what DJ Delorie wrote, stuff from John Carmack, Dave Eberly etc. that were pretty low on rigor but very high on practical value.
- pjc50 8y agoNo, all of that example was malpractice in the 80s when it was written. Note the context: it's highlighted as malpractice in a talk by Brian Kernighan!
- bitL 8y agoI'll bite: argument from authority can be reversed - if Brian didn't mess up the language design, these sorts of "code drivels" wouldn't have appeared! I think you've heard that argument from many language designers already... Then we can argue that back in those times it was something progressive etc. And we are straight back with the argument I was making. When you read StackOverflow, books on Deep Learning or computation on Spark, how much drivel did you go through already? Even the language authors are sometimes confused about some unplanned side effects...
- ZephyrP 8y ago> I'll bite: argument from authority can be reversed - if Brian didn't mess up the language design, these sort of "code drivels" wouldn't have appeared i dont know, awk has its faults -- but blaming it for C?
- maxlybbert 8y agoKernighan didn’t actually design C. He wrote a book with Dennis Ritchie, who did.
- deleted 8y ago[deleted]
- msla 8y ago> if Brian didn't mess up the language design, these sorts of "code drivels" wouldn't have appeared! OK, ignoring the s/Brian/Dennis/ snafu... WTF is a "code drivel"? What are you trying to say here? Second, your point is irrelevant: It's pointless to write a book about driving cars and fill it with a long rant about how riding motorcycles is so much better. It's a non sequitur, and false advertising. Much like how this book is presented as a good resource for learning C and is, in fact, a horrible example of precisely how little the author understood C. > Then we can argue that back in those times it was something progressive etc. Aside from your infelicitous attempt at English, this is wrong: This book was never good, and claiming it was insults the past.