RFR: 8313882: Fix -Wconversion warnings in runtime code [v6]
Coleen Phillimore
coleenp at openjdk.org
Wed Aug 9 20:23:28 UTC 2023
On Wed, 9 Aug 2023 20:02:31 GMT, Dean Long <dlong at openjdk.org> wrote:
>> Coleen Phillimore has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - put checked_cast around getc().
>> - put checked_cast around getc().
>
> src/hotspot/share/runtime/arguments.cpp line 1183:
>
>> 1181: bool result = true;
>> 1182:
>> 1183: char c = checked_cast<char>(getc(stream));
>
> I think this only works if "char" is signed, because EOF is -1. What I meant was:
>
> int c0 = getc(stream);
> while (c0 != EOF ...) {
> char c = checked_cast<char>(c0);
> ...
> c0 = getc(stream);
I don't see this as any cleaner than having the checked_cast in the place where we need to store a char.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15177#discussion_r1289144572
More information about the hotspot-dev
mailing list