Lisp HUG Maillist Archive

NSInteger

NSInteger Hello,

I have a objective-c method getting an NSInteger as one of its arguments. I declare this argument as :int fli type, but the result I obtain is incorrect (I get a big number, positive or negative, when I must receive 0 or 1). Here the objective-c definition :

- (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMinimumPosition ofSubviewAt:(NSInteger)dividerIndex;

I suspect the problem is at lisp level because I don’t found any complain about this from objective-c users on the net.

Do you never experiment something with NSInteger ?

Thanks in advance

Denis

-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgium

Tel : 32 (0)2 219 31 09
Email :  denis.pousseur@gmail.com
Website : http://www.denispousseur.com
-------------------------------------------------------

Re: NSInteger


On Aug 14, 2011, at 7:30 AM, Denis Pousseur wrote:

> I have a objective-c method getting an NSInteger as one of its arguments. I declare this argument as :int fli type

1. Some lisp code would be helpful.

2. NSInteger is a long on 64-bit platforms, an int on 32-bit platforms (see below). Maybe try the fli type cocoa::ns-integer (external but undocumented) which I think will automatically account for target platform.

3. You're talking about a delegate method that conforms to a protocol not available until 10.6 (i.e., the NSSplitViewDelegate Protocol).LWM only includes protocols defined in 10.4 and below, so it may have no knowledge of the protocol in question. I don't know if that's a problem or not.



from <http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_DataTypes/Reference/reference.html>

"NSInteger
Used to describe an integer.

#if __LP64__ || TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
typedef long NSInteger;
#else
typedef int NSInteger;
#endif

Discussion
When building 32-bit applications, NSInteger is a 32-bit integer. A 64-bit application treats NSInteger as a 64-bit integer."


warmest regards,

Ralph
	

Raffael Cavallaro
raffaelcavallaro@me.com






Re: NSInteger

> On Aug 14, 2011, at 7:30 AM, Denis Pousseur wrote:

> 2. NSInteger is a long on 64-bit platforms, an int on 32-bit platforms (see
> below). Maybe try the fli type cocoa::ns-integer (external but undocumented)
> which I think will automatically account for target platform.

Thanks Ralph, it's useful to know this undocumented type. Unfortunately it
doesn't make any difference in this situation. I'm on a 32bit platform, so
the :int type is used anyway.

> 3. You're talking about a delegate method that conforms to a protocol not
> available until 10.6 (i.e., the NSSplitViewDelegate Protocol).LWM only
> includes protocols defined in 10.4 and below, so it may have no knowledge of
> the protocol in question. I don't know if that's a problem or not.

The doc says :
"Available in Mac OS X v10.0 and later.
Available as part of an informal protocol prior to Mac OS X v10.6."

It's not clear for me what's an "informal" protocol and what does lw with
it. But in any case I can use this set of methods without any problem...
except for this argument. So I will look for a work around to find the
divider index.

Best regards,

Denis

> from 
> <http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundat
> ion/Miscellaneous/Foundation_DataTypes/Reference/reference.html>
> 
> "NSInteger
> Used to describe an integer.
> 
> #if __LP64__ || TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_WIN32 ||
> NS_BUILD_32_LIKE_64
> typedef long NSInteger;
> #else
> typedef int NSInteger;
> #endif
> 
> Discussion
> When building 32-bit applications, NSInteger is a 32-bit integer. A 64-bit
> application treats NSInteger as a 64-bit integer."
> 
> 
> warmest regards,
> 
> Ralph


-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgium

Tel : 32 (0)2 219 31 09
Email :  denis.pousseur@gmail.com
Website : http://www.denispousseur.com
-------------------------------------------------------



Updated at: 2020-12-10 08:37 UTC