Re: vMac

new topic     » goto parent     » topic index » view thread      » older message » newer message

Robert Craig wrote:
>In C, you can't code a call to a routine when you
>don't know until run-time how many arguments to pass *or*
>what type those arguments are.
why is it that for the function parameters in this situation,
you cannot simply have a single pointer as your parameter,
and have that single pointer paramenter at runtime point
to an array of pointers to where each pointer at each array
element was a pointer to a parameter you wanted to pass?

you could then pick off each parameter at the beginning
of the function by assigning a temp variable to each of
the pointers located in the individual elements of that
array of pointers passed as the single parameter.

and btw, i used to do it all the time when i coded in
C for a situation whereby i was parsing user input of
sentences that contained nouns and verbs and targets
and actions and the like, and i never knew how long
that argument was going to be,
ergo: how many words each sentence would be.

so i designed all the dependent functions to simply
take one arguement, an array of pointers (holding individual
words) and picked them off as so:
   word1=argument[1]
   if (arguement[2]!=NULL)
    {word2=argument[2]}
   if (arguement[3]!=NULL)
    {word3=argument[3]}
   //and so on until i had enough to perform *that* function
(pardon syntax here, been a long long time)
or something to that effect.

now please, don't get me wrong here, i am not trying to
second guess father euphoria here (i am barely worthy of
being able to hold the shoeshine bottle for his shoeshine
boy), i'm simply asking a question as to why the above
technique cannot be used for passing parameters that
are 'undefined' until runtime... dat's all :)

--Hawke', verily unfit to be the spittle in a spitshine =)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu