atom feed22 messages in net.java.dev.rococoa.usersRe: BOOL mapping issues
FromSent OnAttachments
Harald KuhrFeb 9, 2010 11:58 am 
Duncan McGregorFeb 9, 2010 12:04 pm 
Harald KuhrFeb 9, 2010 12:27 pm 
Harald KuhrFeb 9, 2010 12:37 pm.java
Duncan McGregorFeb 10, 2010 12:37 am 
Harald KuhrFeb 10, 2010 2:39 am.java
Harald KuhrFeb 17, 2010 7:25 am 
Duncan McGregorFeb 18, 2010 1:56 am 
Andrew ThompsonFeb 18, 2010 6:52 pm 
Harald KuhrFeb 19, 2010 6:49 am 
Harald KuhrFeb 19, 2010 7:23 am 
Harald KuhrFeb 19, 2010 10:37 am 
Harald KuhrFeb 19, 2010 12:13 pm 
Duncan McGregorFeb 19, 2010 2:04 pm 
Harald KuhrFeb 19, 2010 3:06 pm 
Andrew ThompsonFeb 20, 2010 8:02 am 
Harald KuhrFeb 20, 2010 1:12 pm 
Andrew ThompsonFeb 20, 2010 5:22 pm 
Duncan McGregorFeb 21, 2010 2:55 am 
Harald KuhrFeb 21, 2010 8:14 am 
Duncan McGregorFeb 21, 2010 8:40 am 
Duncan McGregorFeb 21, 2010 9:01 am 
Subject:Re: BOOL mapping issues
From:Duncan McGregor (dun@oneeyedmen.com)
Date:Feb 21, 2010 8:40:13 am
List:net.java.dev.rococoa.users

On 21 Feb 2010, at 16:15, Harald Kuhr wrote:

1 - Pick a mapping and stick to it. So Java boolean (actually Boolean by the
time we get to the invocation) always maps to int32 with 1 = YES, 0 = NO.

Strictly, BOOL and bool (stbool.h) are both typedef'ed as signed char, I guess
that is a java.lang.Byte in Java. But I figured it didn't make any difference,
as the only values ever used are 0 and 1 and JNA does the magic in any case.

Just goes to show how much we depend on JNA - I'd never even looked to see what
the mapping was - just assumed it would all be alright.

... Hmm.. I did a quick google for boolean types, and it seems that 1 is the most
common way to represent true (see for example
http://en.wikipedia.org/wiki/Boolean_data_type), even though I'm sure they
tought me -1 was the best representation at the university..

Same here, something about -1 allowing logical operations by arithmetic.

Given 1 is the standard in all C variants, it is a little strange that JNA
would choose -1.

I'll do a few experiments and maybe ping Timothy

Duncan