Ok, updated the code as before, so it compiles https://github.com/porres/pd-else/commit/4f052fbe4af3889f06eb69c236f04eeae3555485now I initialize as **x_fval in https://github.com/porres/pd-else/blob/master/Code_source/Compiled/control/var.c#L17At bangs, I get and set the value of the output atom list as SETFLOAT(at+i, *x->x_fval[i]); https://github.com/porres/pd-else/blob/master/Code_source/Compiled/control/var.c#L27In the list method, I get atoms' values with *x->x_fval[i] = atom_getfloat(av+i); https://github.com/porres/pd-else/blob/master/Code_source/Compiled/control/var.c#L36What's weird to me is now that in the 'new' method, I initialize the variable asx->x_fval[i] = var_get(x->x_sym[i] = atom_getsymbol(av+i)); https://github.com/porres/pd-else/blob/master/Code_source/Compiled/control/var.c#L80C9-L80C68and it works, and no need of '*' in here.. I would expect it though... not sure why, just feels right :)But i am just making sure now that all is ok and that my bugs are elsewhere. Also note I am initializing the data as x->x_fval = getbytes(sizeof(float) * x->x_n); in https://github.com/porres/pd-else/blob/master/Code_source/Compiled/control/var.c#L76 and I free it as freebytes(x->x_fval, x->x_n * sizeof(*x->x_fval)); in https://github.com/porres/pd-else/blob/master/Code_source/Compiled/control/var.c#L40C5-L40C55thanksEm seg., 9 de out. de 2023 às 18:28, Alexandre Torres Porres <porres@gmail.com> escreveu:Em seg., 9 de out. de 2023 às 16:37, IOhannes m zmölnig <zmoelnig@iem.at> escreveu:Am 9. Oktober 2023 18:22:11 MESZ schrieb Alexandre Torres Porres <porres@gmail.com>:
>
>*var.c:80:22: **error: **assigning to 'float' from incompatible type
>'t_float *'*
Well it's just what it says: you are trying to assign a `t_float*` value to a `t_float`.
A `t_float` is some floating type, and it is not allowed to use it to store a pointer.Ok, your comment already did shed some light. And looking closely, the [value] code actually uses *x_floatstar ... so let me get this straight, that makes it a pointer then, so it works. Now, I'm also using the same thing to create an array of values, that can be set with something like x->x_fval[i]. This is where things get confusing to me. Now, in an earlier version, this was working and initialized as **x_fval which then it seems it is a pointer to the array of values?In the end, the question would be how to initialize a variable that can take the pointer correctly. Was the last compilable code from https://github.com/porres/pd-else/blob/cd1406cff28baf1eb056d1500fb0d62694171306/Code_source/Compiled/control/var.c completely correct? I guess I got lucky then and when tried to fix what wasn't broken I just ruined it. And the bugs I was trying to fix were unrelated.Another good question would be simple online courses that could help me understand things a little better :)thanks
What's the question?
mfg.sfg.jfd
IOhannes
_______________________________________________
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev