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.