Re: Comparing results of @encode

2008-10-27 Thread Graham Cox
On 27 Oct 2008, at 3:47 pm, Michael Ash wrote: As far as I know the conversion happens upon request, not upon storage. In other words, the internal representation is of the type you initially used to create the NSNumber. If you then request the value through a method whose type doesn't match, i

Re: Comparing results of @encode

2008-10-26 Thread Michael Ash
On Sun, Oct 26, 2008 at 6:23 PM, Graham Cox <[EMAIL PROTECTED]> wrote: >> Also note that NSNumber is smart enough to automatically convert its >> internal representation to whatever you ask for. So for example if >> 'double' encompasses every value you might need, then it's safe to >> simply use [m

Re: Comparing results of @encode

2008-10-26 Thread Graham Cox
On 27 Oct 2008, at 3:28 am, Michael Ash wrote: For this particular case, it would be roughly just as fast and more reliable to do something like: if([myNumber objCType][0] == 'f') The type encoding characters are documented here: http://developer.apple.com/documentation/Cocoa/Conceptual/Obje

Re: Comparing results of @encode

2008-10-26 Thread Michael Ash
On Sun, Oct 26, 2008 at 7:45 AM, Graham Cox <[EMAIL PROTECTED]> wrote: > I'm porting some older code to my project. In this code, a variety of data > types (integer, string, etc) are enumerated in a simple enumeration. I'd > like to be able to automatically figure out what data type I need to use >

Re: Comparing results of @encode

2008-10-26 Thread Jim Correia
On Oct 26, 2008, at 7:45 AM, Graham Cox wrote: I'm porting some older code to my project. In this code, a variety of data types (integer, string, etc) are enumerated in a simple enumeration. I'd like to be able to automatically figure out what data type I need to use from a property's type

Comparing results of @encode

2008-10-26 Thread Graham Cox
I'm porting some older code to my project. In this code, a variety of data types (integer, string, etc) are enumerated in a simple enumeration. I'd like to be able to automatically figure out what data type I need to use from a property's type or, since many properties are encapsulated in a