[PD-dev] shared class data and functions
Jonathan Wilkes
jancsika at yahoo.com
Thu Nov 15 00:16:30 CET 2012
Nevermind, I think I just figured it out by using another set of parentheses to
so that the "x" gets cast before the -> operator.
Guess I'm just going to have to break down and get this pointer business
straight. :)
Thanks again,
Jonathan
----- Original Message -----
> From: Jonathan Wilkes <jancsika at yahoo.com>
> To: Martin Peach <martin.peach at sympatico.ca>
> Cc: pd-dev List <pd-dev at iem.at>
> Sent: Wednesday, November 14, 2012 6:07 PM
> Subject: Re: [PD-dev] shared class data and functions
>
>T hanks Charles and Martin! I forgot the connection between pointers
> and array math-- that's very helpful.
>
> Two questions below:
>
>> ________________________________
>> From: Martin Peach <martin.peach at sympatico.ca>
>> To: Jonathan Wilkes <jancsika at yahoo.com>
>> Cc: pd-dev List <pd-dev at iem.at>
>> Sent: Wednesday, November 14, 2012 9:29 AM
>> Subject: Re: [PD-dev] shared class data and functions
>>
>
>
> [...]
>
>
>>> It seems like I should be able to do this but I can't figure out
> all the
>>> pointer bs.
>>
>> Something like (t_foo *)x->member, or ((t_bar *)x)->member?
>
>
> First, I noticed that I get a warning if I write the function to take an
> argument of type t_object *x and I send it one of type t_theobjectname
> *x. So I'm guessing I should probably go back to my function calls
> and explicitly cast to t_object*, is that right?
>
> Second, (t_foo *)x->member will give me an error: "t_text has no member
> named x_member". I don't understand
> why, because the following works:
>
> t_foo *blah = (t_foo *)x;
> blah->member etc...
>
> -Jonathan
>
>
>>
>> Martin
>>
>>
>>
>>
>
> _______________________________________________
> Pd-dev mailing list
> Pd-dev at iem.at
> http://lists.puredata.info/listinfo/pd-dev
>
More information about the Pd-dev
mailing list