microsoft/Terminal

Don't printf wstring_views by copying them into wstrings; use `%.*s`!

開放

#4,027 建立於 2019年12月19日

 (0 則留言) (0 個反應) (0 位負責人)C++ (9,275 個分叉)batch import
Area-CodeHealthHelp WantedIssue-TaskProduct-ConhostProduct-Terminal

倉庫指標

星標
 (103,173 顆星)
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.

貢獻者指南