-
Notifications
You must be signed in to change notification settings - Fork 840
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
[BUG] Fix crash when enable heavy log and socket id less then 10. #2619
Conversation
90b885c
to
b6bfb69
Compare
b6bfb69
to
f854eb4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am afraid std::setw
does not truncate a value.
The field width determines the minimum number of characters to be written in some output representations. If the standard width of the representation is shorter than the field width, the representation is padded with fill characters at a point determined by the format flag adjustfield (one of left, right or internal).
// setw example
#include <iostream> // std::cout, std::endl
#include <iomanip> // std::setw
int main () {
std::cout << std::setfill('0') << std::setw(2) << 277 << std::endl;
std::cout << std::setfill('0') << std::setw(2) << 2 << std::endl;
return 0;
}
Output:
277
02
The idea here is not to truncate value, but to ensure that the resulting string has at least 2 characters. That's why |
Then |
Exactly, that's what I meant. |
No description provided.