RFR: 8256828: ostream::print_cr() truncates buffer in copy-through case [v3]

David Holmes dholmes at openjdk.org
Tue Jun 4 07:05:10 UTC 2024


On Tue, 4 Jun 2024 04:29:38 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> result_len contains the length of the returned string, including trailing cr, excluding trailing nul

Yes I state that it is the length of the returned string as per strlen.

Yes I can clarify cr is always printed.

> It may bypass the caller-provided output buffer, returning the provided format string directly, if no formatting or copying is needed

Well it _will_ bypass in those cases, though you then need to know when "no copying is needed". The idea was to clearly document the behaviour so that people would no longer be surprised or make assumptions/interepretations.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19512#discussion_r1625457465


More information about the hotspot-dev mailing list