News for hackers. Stuff that matters.
Re:Type Safe Generic Data Structures in C by nice_byte on Monday October 05, 2026 @10:26AM (#49965338)
I've tried doing this for a few years and it just sucks ass. Just use c++ and templates if you need proper generic data structures. C is a defective language.
Re:Type Safe Generic Data Structures in C by uecker on Monday October 05, 2026 @12:16PM (#49966825)
I start to like my experimental macro containers: https://codeberg.org/uecker/noplate/

Examples: https://godbolt.org/z/hecqs78xs https://godbolt.org/z/YnrcjKrEn

Not perfect, but also not really inferior to C++ in my opinion.

Re:Type Safe Generic Data Structures in C by 0xbadcafebee on Monday October 05, 2026 @12:19PM (#49966870)
Can't be all that defective if it underpins most of the technology in the world
Re:Type Safe Generic Data Structures in C by sophacles on Monday October 05, 2026 @01:17PM (#49967657)
It absolutely can. See for example: lead.
Re:Type Safe Generic Data Structures in C by jeltz on Monday October 05, 2026 @02:23PM (#49968519)
We really should lock up the inventor of lead.
Re:Type Safe Generic Data Structures in C by mrheosuper on Wednesday October 07, 2026 @02:52AM (#49989242)
Care to elaborate more ? is it suck because it's toxic to human ?

Most elements on periodic table is toxic to human.

Re:Type Safe Generic Data Structures in C by sophacles on Thursday October 08, 2026 @11:07AM (#50006742)
Problems with lead: it's toxic and it accumulates, lead doesn't leave you and builds up over time. It's not just toxic in the sense that too much will kill you, but even small quantities can cause nerve and brain damage, among other things. It is easier for your body to absorb lead than many other elements.

My comment was pointing out that despite lead being known for millennia as a problem in people, it was used for:

* water delivery pipes * plates and cutlery and cups * a paint ingredient in everyone's home * a sealant * a fuel additive that was spewed into the air by every motor vehical * a lubricant in a lot of machinery * a common additive to many additional products all over the place * a common additive in industrial processes leaving lead residue on products that wouldn't otherwise contain lead.

So the phrase: "underpins most of the technology in the world" somewhat realistically applies to lead - in the early 1900s it was everywhere all the time.

And as i pointed out at the start of this - it is kind of a bad choice to be using all the time in everything since it causes so many problems for people. Humanity has been dramatically reducing the use of lead in everything for a long time now (decades) and will continue to do so for a long time. The bad effects of all the lead use during the industrialization of our species will remain for quite a while.

So my whole point was: just because something was used in the creation of great outcomes, it doesn't make it any good in a fundamental way. I'm saying C is like lead in my analogy.

Re:Type Safe Generic Data Structures in C by esafak on Monday October 05, 2026 @01:13PM (#49967600)
When has that ever stopped a shit language? Just let it die already.
Re:Type Safe Generic Data Structures in C by 0xbadcafebee on Monday October 05, 2026 @04:04PM (#49969891)
Never gonna happen. As soon as you kill it off, someone's going to realize they need a very minimal fast "unsafe" language for something, and reinvent C, probably poorly
Re:Type Safe Generic Data Structures in C by uecker on Tuesday October 06, 2026 @09:34AM (#49978232)
I think it is a pretty good language. Simple, elegant, performant, stable, and fun to write. Most programs I like for being efficient, non-bloated and reliable turn out to be written in C.
Re:Type Safe Generic Data Structures in C by loeg on Monday October 05, 2026 @12:12PM (#49966785)
Or, in 2026, Rust (or Zig, I don't care).