Path: utzoo!utgpu!watserv1!watmath!att!cbnewsh!ijk From: ijk@cbnewsh.ATT.COM (ihor.j.kinal) Newsgroups: comp.lang.c Subject: Arrays of functions - calling them with different number of args. Message-ID: <8553@cbnewsh.ATT.COM> Date: 1 Mar 90 14:08:34 GMT Distribution: na Organization: AT&T Bell Laboratories Lines: 36 I've set up an array of 50 functions, to be called with one standard argument, and my function call looks like this [which particular function to be called is determined by the action_ind. action_tbl [ action_ind ] ( one_arg ) where the one_arg is a pointer to a particular type. Now, I want to add some functions that will have two arguments. The question is, how do I express the call to that function both simply and portably? Obviously, I could provide a list of arguments for each function in my table, and I could test if an arg two is present, then I call action_tbl [ action_ind ] ( one_arg, two_arg ) and otherwise, call the old way. This seems incredibly clumsy. Alternately, I could call EVERY function with two arguments, with the second being null for the actual one-arg functions. Note that I don't want to go back to the source and add a dummy argument to all the old functions. Given that my machine passes the first 4 arguments as registers, I believe that this should work - however, it strikes me as potentially non-portable on some stack machines. What I really want is to construct an arg list and pass that to my function call, but I can't figure how to do that. Any help will be appreciated, Ihor Kinal att!cbnewsh!ijk