How is NSNumber represented on disk?

I don't know why Objective-C decided to use NSNumber instead of float, double, etc. How is this type represented on disk?

+3
source share
3 answers

NSNumber free modem c CFNumber. In recent implementations, Core Foundation CFNumberis a tag with a pointer. This allows us to consider it as an object, but without all the overhead costs of the object. Instead, the value is encoded in the object pointer (and is not really a pointer).

See Tagged Pointers and Fast Integers CFNumber in Lion .

+7
source

NSNumber NSObject, , id: NSarray, NSDictionary .. , int double, , NSObject , , ..

NSNumber. , . , NSNumber, ( ).

+4

, Objective-C - C, NSNumber (float, double, ..), . NSNumber, / . iOS ( ) ( NSObject). , , . NSNumber .

NSNumber:

NSNumber - NSValue, C- () . , unsigned char, short int, int, long int, long long int, float double BOOL. ( , , .) : NSNumber.

, , ( , Jay, ), , . , "32.1", , , , - "32.09999999999999".

, , encodeWithCoder initWithEncoder, , , .

+1

All Articles