3 ms·
C
by adamlett 5y ago
C
- kbenson 5y agoC is only used because it has a widely deployed set of libraries and by it's nature as an underpinning of most foundational software because it was the language of choice when we really started hitting exponential growth in computing. If there wasn't an enormous set of software and source code out there for it already, would there be any reason to use it over anything else? And even then it's latest language standard update was in 2018. You still have to deal with the fact it's changing and keep up with it if you plan to read or use others code. And of you don't, then you can safely not care about advances in C, just as you can safely not care about changes in Go.
- tephra 5y agoC11 introduced type generic expressions.
- c-cube 5y agoNot in the commonly understood sense of "generics", no. You get to switch on a type, but you don't have generic functions or types. A reusable, type-safe Vec or HashMap are still not possible in C...
- pjmlp 5y agoKind of, now that typeof is going to be part of the language, that coupled with the preprocessor, does allow exactly that. Although in typical C fashion is a bit of kludge.
- c-cube 5y ago"coupled with the preprocessor" is a bit of a cop-out :-). Do you have a concrete example of what typeof would enable? Like a basic implementation of a vector type?
- pjmlp 5y agoTrue, it is basically //go: generate, before Go was born. Here is an example, https://codereview.stackexchange.com/questions/101816/generic-vector-implementation-in-c-using-macros https://codereview.stackexchange.com/questions/101816/generi...
- pjmlp 5y agoISO C23 is coming up, and until the last UNIX stops working, C's existence is assured.
- Zababa 5y agoTo add to what other people said, the tooling around C has changed a lot since C was created, partially because there's already so much code in C. The Linux kernel is 20/30 millions lines of code of C mostly, Kubernetes is below 2 millions. So at this point you can still change the language a bit. With C it's harder, so instead people invest in tooling (and replacements).