On 08/20/2018 04:14 PM, Jason Greene wrote: > IMO departing from C semantics (non-zero = TRUE, zero = false) > offers little gain and will likely just lead to hard to catch > bugs. Even if the JNI developer knows the rules, it will be quite > easy for surprises to show up. For example, a developer might assume > a library call always returns 1, and wire it straight to a > boolean. If this assumption is broken (a condition not taken into > account, or future behavioral differences), then it could quickly > turn into a lot of wasted time and effort.
It's tricky, though: a C implementation could silently truncate a value of 0xff00_0000 to (jboolean) 0x00, and there's not a damn thing that a JVM can do about it: there's literally no way to know. It's pretty much unfixable from our end. -- Andrew Haley Java Platform Lead Engineer Red Hat UK Ltd. <https://www.redhat.com> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671