Discussion in 'Mac Programming' started by liptonlover, Sep 11, 2008.

  1. macrumors 6502a

    Mar 13, 2008
    1. Will (id *)aValue accept any type of data, including C variables?

    2. I need to find out what kind of variable/data that id is... how do I do that?

  2. macrumors 68040


    Jan 10, 2005
    Dallas, TX
    I am 99% sure id cannot take a primitive, you'd have to wrap it in an NSNumber. Someone that's a little more familiar may want to chime in if this is incorrect, but id in my mind has to allow for type introspection, and primitives don't carry that sort of information.

    Check out:

    They describe methods that can be called on any NSObject to get its Class or see if it is an object of a particular type. It's not that this is particularly dangerous at all, but runtime introspection (or reflection in some other languages) does require care.


    P.S. Sometimes its just a matter of knowing what to call things. In this case, it's type/runtime introspection. The wikipedia article is actually pretty good on this topic:

Share This Page