<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:12pt"><div><span><br></span></div><div><br></div> <div style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1"> <font face="Arial" size="2"><b><span style="font-weight:bold;">>From:</span></b> Miller Puckette <msp@ucsd.edu><br> <b><span style="font-weight: bold;"></span></b></font><font face="Arial" size="2"><b><span style="font-weight: bold;">>To:</span></b> Jonathan Wilkes <jancsika@yahoo.com> <br><b><span style="font-weight: bold;"></span></b></font><font face="Arial" size="2"><b><span style="font-weight: bold;">>Cc:</span></b> pd-dev@iem.at <br> <b><span style="font-weight: bold;"></span></b></font><font face="Arial" size="2"><b><span style="font-weight: bold;">>Sent:</span></b> Sunday, June
16, 2013 12:53 PM<br> <b><span style="font-weight: bold;"></span></b></font><font face="Arial" size="2"><b><span style="font-weight: bold;">>Subject:</span></b> Re: [PD-dev] Message dispatching system<br> </font> </div> <div class="y_msg_container"><br>>It's a general rule - it was the easiest way to code it portably. If you<br>wanted to truly intersperse floats and integer/pointers you'd have something<br>like a 32-case switch statement to generate the function calls.<br><br>I understand that part of the design. But the other general rule is that<br>the order of args one specifies in the class_addmethod definition fits the<br>order of args as they appear in the c function definition. That's why I asked<br>specifically about graph_array and why it does not follow this general rule.<br><br>Both general rules are sensible IMO.<br><br>-Jonathan<br><br>cheers<br>Miller<br><br>On Mon, May 20, 2013 at 01:41:06PM -0400, Jonathan Wilkes
wrote:<br>> Hi list,<br>> I learned some more about Pd's message dispatching system while<br>> adding jump-on-click mouse clicks and bar graphs to "Put" menu<br>> arrays:<br>> <br>> 1) For type-checked args in class_addmethod, you can specify them in<br>> any order.<br>> 2) Pd re-arranges them, putting the symbol/pointer args first and<br>> the float args last.<br>> 3) In the function for the method you have to specify the args in<br>> the order from #2.<br>> <br>> I see graph_array makes use of these in g_graph.c: the args are<br>> symbol float symbol float float, but the function receives the<br>> symbols as the first two args.<br>> <br>> Was this done to fix a bug or keep something backwards compatible?<br>> Are there other methods done this way? In general I think it's much<br>> better to specify type-checked args in the same order they'll be<br>> received by the
function, meaning symbols/pointers then floats.<br>> Otherwise it makes it more difficult to track down errors.<br>> <br>> -Jonathan<br>> <br>> _______________________________________________<br>> Pd-dev mailing list<br>> <a href="" ymailto="mailto:Pd-dev@iem.at">Pd-dev@iem.at</a><br>> <a href="" target="_blank">http://lists.puredata.info/listinfo/pd-dev</a><br><br><br></div> </div> </div> </div></body></html>