microsoft/Terminal

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

Open

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

在 GitHub 查看
 (0 留言) (0 反應) (0 負責人)C++ (3,212 fork)batch import
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.

貢獻者指南