discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [NSNumber numberWithFloat:] issue


From: Luboš Doležel
Subject: Re: [NSNumber numberWithFloat:] issue
Date: Thu, 19 Feb 2015 14:08:19 +0100
User-agent: Roundcube Webmail/0.5

Hi,

that's strange - I believe that CFRetain() already worked with small NSStrings, because it calls object_getClass() and that returns a special class type for these, hence CFRetain() should just forward the call to [obj retain], which is a NOP.

Could you please send a backtrace with the crash?

Luboš

On Wed, 18 Feb 2015 20:39:27 -0600, Stefan Bidigaray wrote:
That's because CoreBase does not understand "small objects".  These
are objects that have their contents stored as part of the pointer,
instead of being an actual object.  Because they aren't actually
objects, they don't have any reference counting.  Passing a small
object around is like passing a int or double, and do not have to call
malloc or free, making them very fast.

I can implement a quick fix, but it might not until the weekend.  It
would also be very helpful if you created a test case that I could
include in the test suite.  Nothing fancy.  Or, if you're not
familiar with the test suite, a simple program with the expected
output.

Thanks

On Wed, Feb 18, 2015 at 6:16 PM, Amr Aboelela  wrote:

Hello, 

I found that [NSNumber numberWithFloat:] is not toll free bridged
with CoreFoundation
if you do CFRetain on an object result from [NSNumber
numberWithFloat:] it will crash, and if you do a retainCount on it,
it will always give you -1

I feel suspicious about this line:

return boxDouble(aValue, SMALL_FLOAT_MASK);
_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org [1]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep [2]






reply via email to

[Prev in Thread] Current Thread [Next in Thread]