RFR: 8297878: KEM: Implementation [v12]
Ferenc Rakoczi
duke at openjdk.org
Fri Apr 28 08:59:53 UTC 2023
On Fri, 28 Apr 2023 00:47:39 GMT, Weijun Wang <weijun at openjdk.org> wrote:
> I feel the use of `from` and `to` is error prone. I know I never remember if Arrays.copyOfRange() includes or excludes the `to` index. I think less mistakes would be made if it used `index` and `length` instead.
I think from and to are confusing mainly to old C programmers who got used to the "for (I = 0; I < n; i++)" way of expressing a range of length n, a syntax of "for I going from 0 to n-1" would have been more natural (to me at least). When you say "I will be on vacation from the 12th to the 14th of August", you wouldn't think you would be back at work on the 14th, would you (well, maybe an old C programmer would :-) )? To me, "from, to" and "start, length" are equivalent (provided from == start && length == to - from + 1).
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13256#issuecomment-1527201102
More information about the security-dev
mailing list