Currently there are a lot of "defformatstring", "formatstring" and "tempformatstring" used through the codebase to simplify printf-formatting of a string and some variables into a string (e.g. defformatstr(name, "user-number-%d", id_number);.)
This is sometimes slow, but mostly its terrible unsafe in comparison to the fmt lib (aka cppformat).
And since we switch to fmt for new code,
we should convert the old formatting code as well.
It would be stupid to maintain our own formatting library if there already is a well-established alternative and the goal is to drop it as soon as possible.
Tasks:
[x] add fmt/4.1.0@bincrafters/stable to the dependencies.py
(to tell conan to download this dependency prior to building inexor)
[ ] add add_require_conan_lib_function(fmt) to the others in cmake/require_thirdparty_libs.cmake
thats a macro to create a function called require_fmt(<othertarget>)
for cmake. so cmake knows about
[ ] add require_fmt(............) (twice, you'll see) to any module-folders (inexor/..) CMakeLists.txt that is using this lib.
every module needs to require the dependency to its project.
[ ] Find all old-style formatstring and replace them directly with fmt
include the fmt-header in the specific file
convert the API from printf-style to the fmt style
consider stating using namespace fmt; if you are using it a lot in a cpp file.
Currently there are a lot of "defformatstring", "formatstring" and "tempformatstring" used through the codebase to simplify printf-formatting of a string and some variables into a string (e.g.
defformatstr(name, "user-number-%d", id_number);
.)This is sometimes slow, but mostly its terrible unsafe in comparison to the fmt lib (aka cppformat). And since we switch to fmt for new code, we should convert the old formatting code as well. It would be stupid to maintain our own formatting library if there already is a well-established alternative and the goal is to drop it as soon as possible.
Tasks:
fmt/4.1.0@bincrafters/stable
to the dependencies.pyadd_require_conan_lib_function(fmt)
to the others in cmake/require_thirdparty_libs.cmakerequire_fmt(<othertarget>)
require_fmt(............)
(twice, you'll see) to any module-folders (inexor/..) CMakeLists.txt that is using this lib.using namespace fmt;
if you are using it a lot in a cpp file.