On Sun, 9 Jun 2013 13:45:52 -0700, John McCall said:
>Playing with the bit-representation of Objective-C pointers specifically
>is ill-advised because the implementation reserves the right to play its
>own games with object pointers (such as the optimized representation of
>integer values when box
This is correct behavior. C allows casting between pointer and integer types.
It’s used a lot for doing pointer arithmetic. (C’s ancestor BCPL didn’t even
have separate integer and pointer types.)
You might get an optional compiler warning if the integer type narrower than a
pointer, but that’s
On Jun 9, 2013, at 1:32 PM, Kyle Sluder wrote:
> On Jun 9, 2013, at 1:26 PM, Boyd Collier wrote:
>> Quite by chance, I stumbled on to what seems to be an error that ought to be
>> caught by the compiler but wasn't. Here's an example:
>>
>> NSNumber *testNumber = [NSNumber numberWithInt:5];
>
On Jun 9, 2013, at 1:26 PM, Boyd Collier wrote:
>
> Quite by chance, I stumbled on to what seems to be an error that ought to be
> caught by the compiler but wasn't. Here's an example:
>
>NSNumber *testNumber = [NSNumber numberWithInt:5];
>int testInt = (int)testNumber;
>
> […snip…]
Quite by chance, I stumbled on to what seems to be an error that ought to be
caught by the compiler but wasn't. Here's an example:
NSNumber *testNumber = [NSNumber numberWithInt:5];
int testInt = (int)testNumber;
However, the value of testInt when running the above is wildly in