Yuescript icon indicating copy to clipboard operation
Yuescript copied to clipboard

Use string_view lite to remove c++17 dependency?

Open Xrysnow opened this issue 4 years ago • 5 comments

I want to use Yuescript in a c++11 environment and I find it works with help of string_view lite. Is it possible for this official project to do so?

Xrysnow avatar May 24 '21 05:05 Xrysnow

Had a little test for C++11 compiler flag. Yuescript is using other features from C++14 and C++17 alongside with string_view, so we need many refactoring works to make it compatible for old C++ standard. Is there any reason you can't upgrade your compiler to a newer version? Clang、GCC、MSVC and even the Android NDK tool chains are well supporting C++17 standard for the moment. Or you can prebuild Yuescript to a static lib in C++17, and link it into your build environment with other compiler flags.

pigpigyyy avatar May 25 '21 01:05 pigpigyyy

This is because my project has many thridparty libs and they are not easy to move to c++17. Also it's a multi-platform project so I have to make sure they can be compiled from source as much as possible to avoid weird link error at some platform. It would be very helpful if you can make it.

Xrysnow avatar May 25 '21 03:05 Xrysnow

Moving the codes to C++11 just requires some labor work, but I think the main issue is why we must do a downgrade to fix problems and restrain the use of many coding techniques. There is another way to use Yuescript is to use the binary tool compiling codes to Lua before execution. And I can help you with building Yuescript to static libs targeting some common PC and mobile platforms.

pigpigyyy avatar May 25 '21 07:05 pigpigyyy

Well actually I've already had a modified version working in my project. The reason to use c++11 is to make it more accessible for old projects. Current c++14/17 codes can still be available if supported.

But if there is not enough motivation to support c++11 officially, I will use my own version anyway.

Xrysnow avatar May 25 '21 09:05 Xrysnow

Maybe you can make a pr for your tweaked version into a new branch, and I can see if it's possible to use some macro to config the project for different C++ standard with different implementations.

pigpigyyy avatar May 25 '21 09:05 pigpigyyy

No plan for back supporting older C++ compiler since all major platforms C++ compiler is now available for C++17 standards.

pigpigyyy avatar Jan 13 '23 07:01 pigpigyyy