RFR: JDK-8297413: Remove easy warnings in javafx.graphics
Nir Lisker
nlisker at openjdk.org
Sat Nov 26 21:14:16 UTC 2022
On Tue, 22 Nov 2022 22:33:49 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> (long) width * height * 4;
>> is dangerous if one does not remember the precedence rules - is typecast applied to width or the end result?
>> 4L * w * h; is unambiguous.
>
> I'm not sure I like either of the two choices you listed. By "revert it back" I mean leave the code alone. The existing code, with its explicit casts, leaves no room for doubt:
>
>
> return ((long) width) * ((long) height) * 4L;
`4L * w * h;` seems rather clear to me, definitely more than explicitly casting every argument. I assume each person is used to seeing specific patterns and that influences what is easier for them to read.
-------------
PR: https://git.openjdk.org/jfx/pull/960
More information about the openjfx-dev
mailing list