error in using NSNumber's numberWithInt: method not flagged
error in using NSNumber's numberWithInt: method not flagged
- Subject: error in using NSNumber's numberWithInt: method not flagged
- From: Boyd Collier <email@hidden>
- Date: Sun, 09 Jun 2013 13:26:09 -0700
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 incorrect (as one would expect).
The similar code
NSNumber *testDouble = [NSNumber numberWithDouble:5.77];
double myDouble = (double)testDouble;
is flagged with the error message "Pointer cannot be cast to type 'double' ", as it should be.
I'm running OSX 10.7.5 with Xcode 4.6 and using LLVM (I presume).
Should I file a bug report or is this a well-known anomaly that I've just come across?
Boyd
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden