RFR: 8296812: sprintf is deprecated in Xcode 14 [v6]

Xue-Lei Andrew Fan xuelei at openjdk.org
Wed Nov 16 07:16:02 UTC 2022


On Wed, 16 Nov 2022 04:55:17 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> The problem with using the return value of os::snprintf() is that we need to handle the -1 case to prevent the position from running backward. Might be better to use stringStream instead, which should handle the -1 case transparently.
>
> A result of -1 only occurs for an encoding error.  An encoding error is only
> possible with multi-byte / wide characters.  (See the definition of "encoding
> error" in C99 7.19.3/14.) We don't use those, so there won't be any encoding
> errors, so our uses of snprintf never return -1.

Updated to use the result from `os::snprtinf` in the new commit.

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

PR: https://git.openjdk.org/jdk/pull/11115


More information about the hotspot-dev mailing list