Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm generally not a fan, but header-only libraries do make it easier to ensure that specific compiler/linker flags are consistent across your code and the library's code.

Some examples of when this is helpful:

- using gcc's / clang's sanitizer frameworks

- tweaking builds for deep-dive optimization and/or debugging

- letting the compiler target a specific hardware architecture, e.g. `-mavx512f`.

I guess this highlights a limitation in typical Linux systems: a given library can be built with many different configuration options, but there's no (widely known?) way to have all those variants installed at the same time.

I think fixing this would require more than just changing cmake, apt/dpkg, or the C++ standard. A clean solution might also require changes to the ELF standard and/or Linux's compilers, linkers, dynamic loaders, and debuggers.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: