microsoft/Terminal

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

Open

#4.027 aberto em 19 de dez. de 2019

Ver no GitHub
 (0 comments) (0 reactions) (0 assignees)C++ (3.212 forks)batch import
Area-CodeHealthHelp WantedIssue-TaskProduct-ConhostProduct-Terminal

Métricas do repositório

Stars
 (35.764 stars)
Métricas de merge de PR
 (Mesclagem média 27d 19h) (24 fundiu PRs em 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.

Guia do colaborador