microsoft/Terminal

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

オープン

#4,027 opened on 2019/12/19

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)C++ (9,275 件のフォーク)batch import
Area-CodeHealthHelp WantedIssue-TaskProduct-ConhostProduct-Terminal

Repository metrics

Stars
 (103,173 個のスター)
PR merge metrics
 (平均マージ 27d 19h) (30d で 24 merged PRs)

説明

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.

コントリビューターガイド