Codechange: use the fmt library for simpler debug formats - #9352
Conversation
|
Ok, for targets using |
|
Isn't it a header-only library anyway? Might as well just vendor it |
I tried looking for that, but couldn't find it in the source code. So I guess it is in some helper repository. In any case, I have not bothered with that as the decision for "vendoring" it or not needs to be made first. If we are going to vendor it, then adding the library to those lists has been quite futile.
You can use it as header-only library or as normal library. For the former you need to add an extra define before the include, though that should not be a problem. |
cb86294 to
8e86f8c
Compare
8e86f8c to
20331f0
Compare
There was a problem hiding this comment.
This would make life so much better in many ways (how often I get warnings because I used %d instead of %lu .. I cannot even start to tell you about).
PS: I vote to vendor this library; it is small enough after all.
PPS: your description is pretty much out-of-date :P
20331f0 to
777e4d3
Compare
Motivation / Problem
The format codes for
printfare complicated and annoying to work with. When changing something from C-string to std::string you need to explicitly add.c_str(), but also for some types you need to "inject"PRINTF_SIZE.Preferably we would use something in the standard library, but formatting has landed in C++20 so... almost there but not quite yet. There is however the "fmt" library that has the same API as C++20 just in a different namespace, so we can use that as a stop-gap measure until we go to C++20. See https://fmt.dev/7.1.3/api.html#compatibility-with-c-20-std-format
Description
The vendoring of the "fmt" library and full conversion of all DEBUG statements to Debug.
Limitations
fmt::printffunctions, however they do not support things like%ldso using that as a migration step is out of the question.Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.