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.

贡献者指南