microsoft/Terminal
View on GitHubDon't printf wstring_views by copying them into wstrings; use `%.*s`!
Open
#4,027 opened on Dec 19, 2019
Area-CodeHealthHelp WantedIssue-TaskProduct-ConhostProduct-Terminal
Repository metrics
- Stars
- (35,764 stars)
- PR merge metrics
- (Avg merge 27d 19h) (24 merged PRs in 30d)
Description
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.