discuss-gnustep
[Top][All Lists]
Advanced

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

Re: [NSNumber numberWithFloat:] issue


From: Amr Aboelela
Subject: Re: [NSNumber numberWithFloat:] issue
Date: Thu, 19 Feb 2015 11:06:36 -0800

Hi Stefan,

Try:

CFRetain([NSNumber numberWithFloat:0.25])

It will crash


On Wed, Feb 18, 2015 at 6:39 PM, Stefan Bidigaray <stefanbidi@gmail.com> 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 <amraboelela@gmail.com> 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
https://lists.gnu.org/mailman/listinfo/discuss-gnustep





--
Info about Islam: http://wikiz.info/islam


reply via email to

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