cschreib / lxgui

Portable, real time, modular and data-driven GUI C++ library.
https://cschreib.github.io/lxgui
MIT License
73 stars 20 forks source link

Question: why insistence on C++17? #68

Closed smokhov closed 3 years ago

smokhov commented 3 years ago

Just a question why C++17 is forced? I have a couple of older systems that I may need this on, e.g., EL7, which don't have GCC 7+, unless pulling in some oddball devtoolset... Kinda stuck.

What specific features of C++17 are required?

cschreib commented 3 years ago

Hi! A few reasons. C++17 is now four years old, which is an eternity in software. Contrary to C++11, compiler adoption wasn't so slow either, as GCC 7 (which supports all of C++17) came out in 2017. I assumed this would mean the vast majority of users would be able to compile it with their platform's default compiler. This being a library mostly designed for games, and it not having any sort of legacy usage (that I know of), I also assumed that most users of the library would be starting a project from scratch, hence would have no immediate reason to stick to an old standard in their project. I saw C++17 as a trade-off; my current game project using the library actually targets C++20, but I knew this would be too much to ask for most people.

I don't know about your particular distribution, but usually it is fairly straightforward to install a recent clang without messing up with the system GCC. In the past, this is how I was able to use C++11 features when it had just come out. As far as I know, as long as the whole program is built with the same compiler, the resulting binaries can be ported to older distributions (provided the standard library is linked statically, or shipped with the binaries). There is also the alternative to upgrade the distribution, and I know it can be painful, but there always comes a point when you have to bite the bullet :)

As to what features are being used from C++17 inside lxgui:

In addittion, lxgui now uses https://github.com/ThePhD/sol2 (truly the nicest C++ library for managing Lua), and this also requires C++17. Consequently, I'm afraid at the moment it is not possible for me to allow compiling on older standards without considerable effort.

smokhov commented 3 years ago

@cschreib -- thanks for the detailed answer. It's quite clear. The material you wrote above is a README/appendix worthy material :) I have systems running CentOS 7 and Scientific Linux 7, both are clones of RH EL 7. I will see if clang is available on them. But as an alternative this is why I asked for docker in #69 :)

Feel free to close this as the question has been answered!

cschreib commented 3 years ago

I'll refrain from adding this to the readme I think, it is already far too long! Maybe it needs splitting up into sub-files already. I'll consider it when I get to it ;)