5 ms·
I wonder how you like my vector: https://godbolt.org/z/97YGrbP9s https://godbolt.org/z/97YGrbP9s (note, experimental library, but I see no fundamental issue).
by uecker 1y ago
I wonder how you like my vector: https://godbolt.org/z/97YGrbP9s https://godbolt.org/z/97YGrbP9s
(note, experimental library, but I see no fundamental issue).
- bluGill 1y agothat is amazing... I don't write C so I didn't dig too deep, but kudos for getting anything to work. Now you use need great documentation so we can figure out how to use it and what it supports without digging into the macros themselves. (tests would be good too, but maybe they are there and I didn't see them).
- uecker 1y agoyes, unfortunately I do not have a lot of time... maybe I can some funding, but C work this is difficult.
- viega 1y agoOh, this is very good. Some of the stuff you're doing in the library I've also been doing recently, and has been working well, like using the string of the type name to allow for run-time checking of, what I would called "mixed" data (your variadic type). I've also done the same basic thing as your option type in a way that's closer to your sum type than the maybe type. But I'd had enough problems trying to get something like your vector actually working that I'd given up, but I think now I'll build something at some point over the holidays. I think as I'm coming up to speed on the history of changes to _Generic that's partially due to the attempts before I had a C23 compiler, but even then, your code there is impressive-- both clear and clever. I also have enough stuff passed via pointer that the option type for me needed to handle pointers differently-- I basically just have run-time code that does the null check at run time when set. At that point, there doesn't really need to be an 'is_set' type flag.
- viega 1y agoBy the way, the run-time type checking is one of the use cases where I really would like to have a tractable interface for hashing at compile time, preventing unbounded strcmps, and turning them into an integer compare (without having to manage caching such things at runtime). Same thing would be for making it much easier to statically lay out fixed caches implemented via hashing, instead of inserting into them at start-up, etc.