|
|
Le 2020-06-09 à 06:07, jr a écrit :
> hi,
>
> I have a macro which expands to an array, eg
>
> #macro mkArr(...)
> .....
> array [2] {...}
> #end
>
> which gets assigned, repeatedly, to the same '#declare'd variable. is this ok
> wrt memory management, or is it better to '#undef' the elements, and or the
> array, before replacing it wholesale? is there a difference? do 'mixed' arrays
> behave same as "normal" arrays?
>
>
> regards, jr.
>
>
Whenever you assign a new value to any variable, the new value simply
replace the old one in the same memory space.
The only issue that may arise for memory management, is when you assign
a string that don't always have the same length.
So, you don't need to #undef.
I don't know for mixed arrays.
You may need to #undef if you want to assign a new value of a different
type like float to vector or string.
Post a reply to this message
|
|