glouw/ctl
View on GitHub ↗ ★ 1,382 C
The C Template Library
22 mentions on Hacker News by 8 people: 1 story, 21 comments · first 2020-10-25 · latest 2025-06-27
20082026
-
…whole files "parameterized" by their macro environment like https://github.com/c-blake/bst or https://github.com/glouw/ctl/ Add a namespacing macro and you have a whole generics system, unlike that in TFA. So, it might add more value to…
comment by cb321 · 2025-06-27 · in Parameterized types in C using the new tag compatibility rule -
Probably worth mentioning the C Template Library [1]... [1]: https://github.com/glouw/ctl/
comment by spacedcowboy · 2025-03-19 · in Implementing Generic Types in C -
Maybe not it, but STC ( https://github.com/tylov/STC ) and CTL ( https://github.com/glouw/ctl ) both use this define method for creating data structures and linking up compare functions for them.
comment by KapKap55 · 2022-05-24 · in Modern programming languages require generics -
…C++, with a little (reasonable) preprocessor abuse. It gives great cache contiguous results: https://www.github.com/glouw/ctl
comment by glouwbug · 2022-05-17 · in Common libraries and data structures for C -
While I agree the common pattern is to use void*/dynamic dispatch, this is not necessary. E.g., https://github.com/glouw/ctl/ or https://github.com/c-blake/bst show a couple ways to have generic code statically specialized in regular old…
comment by cb321 · 2021-11-12 · in The Rust compiler has gotten faster again -
…while maintaining compile time type safety and gaining speed and maintainability looks something like this: github.com/glouw/ctl Check CTL/vec.h, for instance
comment by glouwbug · 2021-07-23 · in Macros on Steroids: How pure C can benefit from metaprogramming -
CTL. https://github.com/glouw/ctl It's functionally blackbox compatible with the STL for the major containers. Unless you're writing heap spaced firmware where C++ with an STL isn't available I recommend you just use modern day C++.…
comment by glouwbug · 2021-07-10 · in Metaprogramming custom control structures in C (2012) -
…like it as far as I know. The closest alternative is CTL but it doesn't have any of those features: https://github.com/glouw/ctl/
comment by ludocode · 2021-05-17 · in Ask HN: What are some tools / libraries you built yourself? -
…previous implementations. The two I’ve found more interesting are: - “C Template Library (CTL)”: https://github.com/glouw/ctl - “Klib: a Generic Library in C”: https://github.com/attractivechaos/klib/
comment by AlbertoGP · 2021-04-23 · in Beej’s Guide to C Programming [pdf] -
…library, one that tries to more directly port C++ templates to C but with a lot less features: https://github.com/glouw/ctl/
comment by ludocode · 2021-04-09 · in Type-safe generic data structures in C -
https://github.com/glouw/ctl/
comment by cb321 · 2021-03-13 · in Speed of Rust vs. C -
…to think. This is probably largely why @mehrdadn's original article had the title it did. ;-) } [1] https://github.com/glouw/ctl/ [2] https://nim-lang.org
comment by cb321 · 2021-03-04 · in Accidentally quadratic: When Python is faster than C++ -
Ye, I pushed it to the extreme and back ported a good chunk of the STL to C: https://www.github.com/glouw/ctl
comment by glouwbug · 2021-01-23 · in C++ Anti-Patterns -
Eh, even C supports clean templated type safe containers: https://www.github.com/glouw/ctl Why Go is so far behind is behind me
comment by glouwbug · 2021-01-13 · in A Proposal for Adding Generics to Go -
…to int compare(int, int) when P is defined? I wonder if it impacts at all the benchmarks. [1] https://github.com/glouw/ctl/blob/49b90312f9473057fd2ed77941...
comment by teabee89 · 2020-12-30 · in C Template Library -
Yes, as many templates as you like. An A* pathfinder, for instance: https://github.com/glouw/ctl/blob/master/examples/astar.c#L8... Although if you're interested in just a batch rename, it's something like this: #define vec_char str…
comment by glouwbug · 2020-12-30 · in C Template Library -
…possibly "cloning" to do the same, which is less likely for a complicated algorithm like sort. [1] https://github.com/glouw/ctl/blob/09f5e0a89d3fc621aff94290c4... edit: I wonder how ctl's vector sort compares to qsort, I expect it to be…
comment by leni536 · 2020-12-30 · in C Template Library -
…6502 compiler. I have also written a small wiki, that showcases how to use the included containers: https://github.com/glouw/ctl/wiki
comment by glouwbug · 2020-12-29 · in C Template Library -
▲ 266
C Template Librarystory by glouwbug · 2020-12-29 · 128 comments
-
…porting parts of the C++ STL to C, so it may have a dictionary type now, depending on who you ask! https://github.com/glouw/ctl
comment by glouwbug · 2020-12-21 · in More challenging projects every programmer should try -
I've been working on this which you might find of use: https://github.com/glouw/ctl
comment by glouwbug · 2020-12-17 · in Getting started with C -
If anyone is interested, I'm in the process of back porting the STL to C99: https://github.com/glouw/ctl The gist of its workings is including a header and defining its type: #define T int #include <vec.h> #define T float #include <lst.h>…
comment by glouwbug · 2020-10-25 · in What's Wrong with C++ Templates? (2003)