VC++ Warnings about t_atoms
Hi there. I’m learning how to write my own externals. I’m successfully writing my own functioning objects at this point, but I’m concerned that I’m not using the data types quite right. Here’s a Warning message I get when I build.
warning C4047: ‘function’ : ‘t_atom *’ differs in levels of indirection from ‘t_atom (*)‘
here’s the function where this occurs
void minimum_list(t_minimum *x, t_symbol *s, short ac, t_atom *av)
Not sure what it’s warning me about..also I don’t really understand why I have too go like this "listOut+i" instead of "listOut[i]". But it works.
The quick explaination is that pointers and arrays are almost the same thing in C – namely, an array can actually be seen as a pointer to its first element. So listOut is the same as &listOut, listOut+i is the same as &listOut[i] and the type for each of them is t_atom*. As a consequence, the type for &listOut is t_atom**, which is not what outlet_list wants.
In fact the matter is complex, and dealing successfully with the Max API requires quite a deep understanding of C pointers. So, my suggestion is to take a good C textbook (there’s plenty of links in the forum) and study carefully everything about pointers and arrays.
Finally, questions about coding C externals should be posted on the Dev forum – you have more chances of getting a quick reply!
Thanks guys. I think I see what andrea means. t_atoms is already a pointer, and it becomes a pointer to a pointer the way it’s used. Maybe I do need a refresher on pointers. I’ve read lots of C programming books…just a little rusty maybe.
I’ll take a good read through the manual too.