Hi, Congcong Kuo <congcong....@gmail.com> writes:
> In nix/libutil/util.cc there are lots of functions related to > copy/delete files and manipulate file paths. In C++ 17 the standard > library’s <filesystem> provides the same functionality which is more > reliable. > > guix-daemon uses Boost.Format to generate formatted string. These code > are copied into nix/libformat directly and I think it is not a good > practice. With C++ 20 we can use <format> from C++’s standard > library. I have done some experiments on it [2]. In my code repo I > replace all boost::format with std::format in nix/libutil. > > We can use <filesystem> if we upgrade from —std=c++11 to -std=c++17. For > <format> we need GCC 13 with -std=c++20. In general I would consider the C++ daemon code to be read-only, though in practice it’s been changing quite a bit lately; I would remain mostly conservative though. My take: 1. Yes to ‘-std=c++17’ and any change required to make that work. 2. Using ‘std::format’ would be nice, *if* that works with GCC 11, as Efraim wrote. 3. I’m reluctant about using <filesystem> because the few functions you mention are security-sensitive. We would need to look at the implementation of libstdc++ and perhaps at the spec to see whether their counterpart is appropriate. Thoughts? Ludo’.