Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid sprintf, in favor of hr::format and snprintf #340

Merged
merged 2 commits into from
Aug 22, 2023

Conversation

Quuxplusone
Copy link
Contributor

Apple Xcode now gives -Wdeprecated-declarations on any attempt to use sprintf. Which is silly, but also easy to fix.
C++20 adds std::format, which will ambiguate unqualified calls to hr::format. Add the qualification everywhere.
No intended functional change (although the calls to hr::format do perform more memory allocations than the old raw s[n]printf calls did).

C++20 introduces `std::format` and we `using namespace std`,
so some of these would be ambiguous in C++20.
Apple Xcode has started giving `-Wdeprecated-declarations` warnings
for `sprintf`, and suggesting that people migrate to `snprintf` instead.
This is silly, but the warnings are spam and need to be silenced
somehow. Migrating to `snprintf` and/or `hr::format` is the path of
least resistance.
@zenorogue zenorogue merged commit 04f31aa into zenorogue:master Aug 22, 2023
7 of 23 checks passed
@Quuxplusone Quuxplusone deleted the format-sprintf branch August 24, 2023 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants