> On Aug 20, 2018, at 12:23 PM, Andrew Haley <a...@redhat.com> wrote: > > 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.
OK but in that case the C developer can see its an unsigned char, and their compiler is likely to throw an overflow warning. Granted, it’s also true that int is a more common return value than unsigned char. -Jason