You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When moving an application from using standard varargs and printf formatting to
cppformat the throwing printf("%p", "cstring") is problematic and a source for bugs.
This since (on most platforms?), standard usage of ("%p", "cstring), will not throw
but just print the pointer value as if an explict cast to void const * where there.
It seems easy to add support for this to cppformat without having un-casted support for
other pointers.
This is the change I did to my local copy of cppformat to make "%s", "cstring" work as
wanted/expected:
Good catch, thanks! You are quite right that printf("%p", "cstring") should work but the fix needs a bit more work to prevent formatting of objects of type std::string as pointers. I'll look into it shortly.
When moving an application from using standard varargs and printf formatting to
cppformat the throwing printf("%p", "cstring") is problematic and a source for bugs.
This since (on most platforms?), standard usage of ("%p", "cstring), will not throw
but just print the pointer value as if an explict cast to void const * where there.
It seems easy to add support for this to cppformat without having un-casted support for
other pointers.
This is the change I did to my local copy of cppformat to make "%s", "cstring" work as
wanted/expected:
The text was updated successfully, but these errors were encountered: