3 ms·
> you can't drive your tooling Can you suggest what tooling actually can help to implement algorithms and data structures libraries with generic types in a cle
by distcs 3y ago
> you can't drive your tooling
Can you suggest what tooling actually can help to implement algorithms and data structures libraries with generic types in a clean way?
- kevin_thibedeau 3y agoThe issue here is people too lazy to tell their compiler where to find a header file so instead they cook up a bespoke system that is specific to every library using this approach.
- deleted 3y ago[deleted]
- electroly 3y agoThat is not why this project is header-only. It's so you can include it multiple times to produce multiple specialized types; it has to be header-only so it can produce a series of structs and functions for each specialized type into your compilation unit, with the compiler separately checking each produced specialization. You configure it before including using a series of preprocessor defines. It's a common way to handle generic types in C. This can't be a single separate compilation unit that you link in; the generic specialization doesn't work that way. You seem to be talking about libraries that are header-only purely for convenience but this is not one of those projects. With a library like this, you'd want to have one .c file in your project that produces all the implementations for your specialized types, then link that with the rest of your project. From a quick look at the doc, this project supports this.
- downvotetruth 3y ago> one .c file in your project that produces all the implementations for your specialized types That depends on the compiler, linker and desired linking being static or dynamic and resource concerns. If dynamic, the entire specialized/monomorphized library could be loaded for a single function compared to static linking with the "-O2 -flto" options that removes unused functions.