Ah, one of those "generic" libraries back from MS-DOS days.
> Ah, one of those "generic" libraries back from MS-DOS days. Nothing about this screams "MS-DOS".[1] Why the disparagement? [1] I know, I was programming at that time.
A header-only C implementation of C++
51–60 of 94 posts
Re: A header-only C implementation of C++ <algorithm>
#52Earlier quoted context omitted.
God I wish everything was done in this way. Even the C standards committee moves too fast and adds features that have no place in the standard.
Well, there are people who choose to stay away from social and technical progress. I totally respect that desire.
And I'm not saying there isn't room for improvement. There are lots of genuinely useful features C is missing, especially regarding static analysis. I would love to have a proof assistant that can integrate with a C/C++ compiler to prove equivalence of functions, so you could write an obvious version and then transform it step by step to an optimized version, which is guaranteed to have the same observable behaviour.
Re: A header-only C implementation of C++ <algorithm>
#53Why header only? Jesus christ, we have a linker.
Re: A header-only C implementation of C++ <algorithm>
#54Well, I do like mine better, which is closer to the STL, and for all containers. https://github.com/rurban/ctl/
I think our projects are completely different and don't have the same goals. 1. You don't implement the most important algorithms. For example `stable_sort` for arrays. So right there, it's not even a substitute. One of my motivations from the start was simply to have `stable_sort` in C (to implement database queries). 2. Yours is a clever implementation of C++ features using macros. But it's not idiomatic C. If some…
Your variant being static is indeed nice, the STL, CTL cannot do that, just MTL exists for that. Which supports all containers. E.g. Non-vector types allow for much faster inserts.
You can only replace insitu, which is the opposite of functional. No backtracking. Manual copying needed. The spirit of the STL algorithms is to allocate, not overwrite.
Re hash-map: this is not even finished. For now it's just a pointer-stable unordered_map with optimizations for all types, primitives or strings. optimized Swisstable (string) and Stanford hashes (u64) are in work (no time for that), and are indeed multiple times faster.
Re: A header-only C implementation of C++ <algorithm>
#55Earlier quoted context omitted.
"Social progress" got us the holocaust and tens of millions killed by communism, though. It's perfectly reasonable to be wary of it.
It also ended serfdom. Being wary of change is usually the excuse to perpetuate awful systems in both technology and society.
Hardly.
Re: A header-only C implementation of C++ <algorithm>
#56Earlier quoted context omitted.
That isn't modern C. It's the cool kids backporting a misfeature from C++ because that's what all the game devs do. Header only serves no purpose in C other than to demonstrate that you can't drive your tooling. Plus you've created a new burden to keep track of the magic define that activates the definitions in the code and the one file where it's invoked.
> demonstrate that you can't drive your tooling Apparently few can. How many image libraries came before `stb_image`? KISS is a feature. Also, tooling changes between platforms and build systems.
I understand that some libraries are themselves so big and complex that they need a build system. Each library I want to use that doesn’t is a blessing.
Re: A header-only C implementation of C++ <algorithm>
#57Earlier quoted context omitted.
> Ah, one of those "generic" libraries back from MS-DOS days. Nothing about this screams "MS-DOS".[1] Why the disparagement? [1] I know, I was programming at that time.
Common C libraries in MS-DOS, before Borland C++ and Watcom C++ took over.
Honestly, never came across those in the C compilers I used back then.
Re: A header-only C implementation of C++ <algorithm>
#58Well, I do like mine better, which is closer to the STL, and for all containers. https://github.com/rurban/ctl/
Honestly, who cares? On a more constructive side, I think adding some value by giving the poster some feedback or engaging in a conversation about the topic would be nice, otherwise it just sounds as an attempt to show off. I'm not a fan of these "header only" projects nor am I a fan of overly clever code because even though it's fun and rewarding to write it's not a great fit for larger or collaborative projects whe…
Why not? rurban's work is solid and should be shown off.
Re: A header-only C implementation of C++ <algorithm>
#59Well, I do like mine better, which is closer to the STL, and for all containers. https://github.com/rurban/ctl/
I wonder why it's a so common pattern here that everytime someone shows their product, someone in the comments will show their own version in a not-so-implicit patronizing tone