about attributes

    Sep 24 2012 | 2:58 pm
    I have two questions about attributes:
    1 - Do I have a way to retrieve the offset of an attribute in the object structure from its getter/setter? that is, is there a workaround (dunno, maybe calling some attribute method) for some sort of long attribute_get_offset(t_object *attr)?
    2 - According to the documentation, it appears that an attribute getter could receive non-NULL ac and *av, in which case memory has already been allocated for them. But how can I know how much memory it is? From the value of ac? And what happens if that memory is not enough? Can I resize it with sysmem_resizeptr()?
    Thanks! aa

    • Oct 24 2012 | 3:20 pm
      1. You can try to call a "getoffset" method e.g.
         long offset = object_method(attr, gensym("getoffset"));
      Not all attributes are defined in terms of an offset, but if it is this should return it.
      2. Yes, you can know from checking ac and then branching accordingly to alloc or resize.
      Cheers, Tim