Hacker News new | past | comments | ask | show | jobs | submit login

Uh, not to be That Guy, but what did you expect? Just compare K&R [1] and Stroustrup (any edition) [2] next to each other, and you will get a pretty strong hint of C being a smaller language. That's kind of the point, or it used to feel like it was anyhow.

[1]: https://en.wikipedia.org/wiki/The_C_Programming_Language

[2]: https://www.stroustrup.com/4th.html




Being a small language is not an excuse. Scheme is a small language, still has dynamic-wind (since R5RS, so no spring chicken). Smalltalk is a tiny language, but has BlockClosure#ensure:.

You can have basic safety and QOL features without making the language a monstrous beast. Hell, you can cut old garbage like K&R declarations or digraphs to make room. You can even remove iso646 and most of string.h as a gimme.


First of all, if you are comparing K&R against Stroustrup, then you should use C++ARM, not later editions.

Secondly, Bjarne's books include the overview of the standard library, which neither K&R nor its ANSI C revision do.

Third, since everyone keeps using compiler extensions in C, moreso than in C++, those should be included as well.


At least in my ancient copy (second edition, from 1988 I think) K&R most definitely has an overview of the standard library, in Appendix B.


I stand corrected on that matter it seems.


I mean, it's not that I didn't expect changes or didn't expect the language to be smaller - it's just that there definitely things that I would want to bring with me over to C. One thing I really like is RAII - that I can ensure that things are cleaned up in a known, once-defined fashion and I don't have to worry about it everywhere I use a given object. I also generally like using early returns, which is somewhat more complicated with C, as I may need to have more cleanup code around. It can be somewhat mitigated by coding more functionaly and input the necessary parameters to a function, so I can have a different function just doing allocation and deallocation. But still, it's more verbose.

`defer` would to some degree solve that issue.

Similarly, I've been missing nullptr, just for the expressiveness. I like that C23 now includes it :)




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: