On Tue, 12 Jul 2011, Mathieu Bouchard wrote:

On Tue, 12 Jul 2011, Jonathan Wilkes wrote:

Mathieu Bouchard <[email protected]> wrote:
EXTERN int canvas_isabstraction(t_canvas *x);
declared in #include "g_canvas.h"

but it takes a t_canvas and I have a t_object.

pd_class(x)==canvas_class ? canvas_isabstraction((t_canvas *)x) : 0;

thus you check whether it makes sense to cast the pointer to t_canvas*, and if it does, you call the function, otherwise you know that it's not an abstraction.

sorry, pd_class(x) is just *(x), so it assumes that typeof(x) is t_pd*, or in other words, t_class**.

so you can write
pd_class((t_pd *)x)==canvas_class ? canvas_isabstraction((t_canvas *)x) : 0;

or just
*(t_pd *)x==canvas_class ? canvas_isabstraction((t_canvas *)x) : 0;

 _______________________________________________________________________
| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC
_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to