Giving C++ std:regex a C makeover
https://nullprogram.com/blog/2024/09/04/- I can't say that I like this very much.
Problematic macro in the header, custom string type compatible with nothing else in C, and I have no idea where the arena type comes from.
Having it magically deallocate memory is nice, but will confuse C programmers reading the caller.
Honestly, adding -lre to the linker is just much easier, and that library comes with docs too.
-- lelanthran Reply - This is fun and impressive, but it feel the author kind of misses out on explaining in the intro why it would be wrong to just ... use C's regex library [1]?
I guess the entire post could be seen as an exercise in wrapping C++ to C with nice memory-handling properties and so on, but it would also be fine to be open and upfront about that, in my opinion.
1: https://www.man7.org/linux/man-pages/man3/regex.3.html
-- unwind Reply