[PD-dev] Message dispatching system

Miller Puckette msp at ucsd.edu
Sun Jun 16 18:53:48 CEST 2013


It's a general rule - it was the easiest way to code it portably.  If you
wanted to truly intersperse floats and integer/pointers you'd have something
like a 32-case switch statement to generate the function calls.

cheers
Miller

On Mon, May 20, 2013 at 01:41:06PM -0400, Jonathan Wilkes wrote:
> Hi list,
>      I learned some more about Pd's message dispatching system while
> adding jump-on-click mouse clicks and bar graphs to "Put" menu
> arrays:
> 
> 1) For type-checked args in class_addmethod, you can specify them in
> any order.
> 2) Pd re-arranges them, putting the symbol/pointer args first and
> the float args last.
> 3) In the function for the method you have to specify the args in
> the order from #2.
> 
> I see graph_array makes use of these in g_graph.c: the args are
> symbol float symbol float float, but the function receives the
> symbols as the first two args.
> 
> Was this done to fix a bug or keep something backwards compatible?
> Are there other methods done this way?  In general I think it's much
> better to specify type-checked args in the same order they'll be
> received by the function, meaning symbols/pointers then floats.
> Otherwise it makes it more difficult to track down errors.
> 
> -Jonathan
> 
> _______________________________________________
> Pd-dev mailing list
> Pd-dev at iem.at
> http://lists.puredata.info/listinfo/pd-dev



More information about the Pd-dev mailing list