microsoft/Terminal
在 GitHub 查看Don't printf wstring_views by copying them into wstrings; use `%.*s`!
Open
#4,027 建立於 2019年12月19日
Area-CodeHealthHelp WantedIssue-TaskProduct-ConhostProduct-Terminal
倉庫指標
- Star
- (35,764 star)
- PR 合併指標
- (平均合併 27天 19小時) (30 天內合併 24 個 PR)
描述
StringCchPrintf and--since C99--printf support a specifier that indicates that a string is counted:
auto size = /* ... */;
auto data = /* ... */;
printf("%.*s", size, data);
The .* suggests that printf should consume one register-width argument to determine how many characters the string that follows contains instead of waiting for a null terminator.