Forums > Dev

CLASS_ATTR_ATOM_VARSIZE with large arrays

August 22, 2012 | 1:40 pm

So, I assumed I could use CLASS_ATTR_ATOM_VARSIZE on a dynamically allocated array of atoms (so I have only a pointer to the atom array in my struct), but it appears that this call assumes that the array is a real array within the struct….

What is the best way around this problem – is it simply a case of writing my of getter (I already have a custom setter which I assume works correctly), or is there a better way to go about this?

If I am writing my own custom getters and setters can I somehow use a t_atomarray to get a dynamic array with all those cool features?

FWIW I do not want to limit the size of the atom array to be too small, so I cannot have a real array in my struct….

Thanks

Alex


August 22, 2012 | 3:47 pm

Hi Nicolas – thanks for that – unfortunately this is not appropriate in my case as I really do need it to be an attribute – most of the time the arrays will be small – but the option needs to be there for a much longer array. Thanks also for your previous reply which links to a thread with all the answers I needed!

Anyway, I’ve just written a custom getter and it seems happy – it’s just that the custom getter (and presumably setter) assume a real array….. So, I seem to be sorted. I’d be interested to know if I actually have to have a maximum array size in this scenario, as I’m allocate the array for the getter, but a fixed maximum size is fine for me right now.

Alex


August 22, 2012 | 5:20 pm

I hadn’t but this pretty much confirms what I have discovered. Anyway – good to have it official and have a link to something for anyone following this thread….

Thanks

A.


Viewing 3 posts - 1 through 3 (of 3 total)