How do I check the type of a value on runtime?
I'd like to find out where I'm creating doubles.
How do I check the type of a value on runtime?
I'd like to find out where I'm creating doubles.
With very few exceptions, you never need to check type at runtime. Typed variables can only hold their assigned types, and type promotion is determined at compile time.
If you're using Objective-C classes, then the [myObject isKindOfClass: [InterestingClass class]]
test is available. If you're using primitive types (which your question, quoting the "double" type, suggests), then you can't. However unless you're doing some very funky stuff, the compiler can tell you when primitive types do or don't match up, and when it doesn't will perform implicit promotion to the desired type.
It would be beneficial to know a little more about what the specific problem is that you're trying to solve, because it may be that the solution doesn't involve detecting the creation of doubles at all :-).