News for hackers. Stuff that matters.
Re:Generics enabled by default in Go tip by adamlett on Saturday August 21, 2021 @02:53AM (#28254854)
C
Re:Generics enabled by default in Go tip by kbenson on Saturday August 21, 2021 @02:57AM (#28254868)
C 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.

Re:Generics enabled by default in Go tip by Zababa on Saturday August 21, 2021 @04:13AM (#28255167)
To 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).
Re:Generics enabled by default in Go tip by tephra on Saturday August 21, 2021 @02:59AM (#28254876)
C11 introduced type generic expressions.
Re:Generics enabled by default in Go tip by c-cube on Saturday August 21, 2021 @11:34AM (#28257810)
Not 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...
Re:Generics enabled by default in Go tip by pjmlp on Sunday August 22, 2021 @06:17AM (#28264268)
Kind 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.

Re:Generics enabled by default in Go tip by c-cube on Sunday August 22, 2021 @02:04PM (#28267869)
"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?
Re:Generics enabled by default in Go tip by pjmlp on Sunday August 22, 2021 @03:23PM (#28268612)
True, it is basically //go: generate, before Go was born.

Here is an example, https://codereview.stackexchange.com/questions/101816/generi...

Re:Generics enabled by default in Go tip by pjmlp on Saturday August 21, 2021 @03:04AM (#28254901)
ISO C23 is coming up, and until the last UNIX stops working, C's existence is assured.