1
SFML development / Re: C++ standards
« on: August 28, 2018, 02:38:36 pm »
Here is my current opinion, considering SFML:
Go with C+17.
Aguments:
- std::filesystem : if SFML relies on it by default (or not use filesystem at all and let the user feed SFML), the codebase would be reduced;
- std::string_view: There are several (not all) interfaces of SFML that take std::string while std::string_view would be a far better default. Notably the API for passing shader scripts (which imply a lot of copies). I pointed this issue before but the (reasonable) answer was that adding a string-ref type would be another thing to maintain, and there is no SFML dependency providing one. With C++17 std::string_view would do the job.
- std::any and std::optional might be very helpful in several SFML APIs evolutions.
- it's completely implemented by major compilers (I think there might be holes that SFML will not use anyway);
- if the next release of SFML happen around the end of the year or next year, there will be about a year before the following standard is ratified (and a lot of it's stabilized features are already implemented in at least 2 compilers);
- backward compatibility should be good enough to not force users to change their code (except for changing APIs);
- it's the simplest way to open the possibility of reducing drastically codebase size (less code, less bugs - most of the time) (I'm htinkin both C++14 and C++17 here);
- changing the C++ version do not mean that all the code have to be upgraded immediately or ever, but it makes it possible and easy to check;
I was wondering: what are the arguments against going directly to the current standard? It's not really clear from the current discussions.
Go with C+17.
Aguments:
- std::filesystem : if SFML relies on it by default (or not use filesystem at all and let the user feed SFML), the codebase would be reduced;
- std::string_view: There are several (not all) interfaces of SFML that take std::string while std::string_view would be a far better default. Notably the API for passing shader scripts (which imply a lot of copies). I pointed this issue before but the (reasonable) answer was that adding a string-ref type would be another thing to maintain, and there is no SFML dependency providing one. With C++17 std::string_view would do the job.
- std::any and std::optional might be very helpful in several SFML APIs evolutions.
- it's completely implemented by major compilers (I think there might be holes that SFML will not use anyway);
- if the next release of SFML happen around the end of the year or next year, there will be about a year before the following standard is ratified (and a lot of it's stabilized features are already implemented in at least 2 compilers);
- backward compatibility should be good enough to not force users to change their code (except for changing APIs);
- it's the simplest way to open the possibility of reducing drastically codebase size (less code, less bugs - most of the time) (I'm htinkin both C++14 and C++17 here);
- changing the C++ version do not mean that all the code have to be upgraded immediately or ever, but it makes it possible and easy to check;
I was wondering: what are the arguments against going directly to the current standard? It's not really clear from the current discussions.