Re: Variable number of arguments



Richard Maine wrote:
(snip)

But your current problem is probably different. Fortran character
arguments have extra data associated with them. As long as you are just
in Fortran, that is taken care of "behind your back". When you try to
mix languages, it is visible and must be accounted for. The details *DO*
vary from compiler to compiler.

The most common scheme is to pass the address of the string as one
argument and the length in a separate argument, which the compiler
constructs for you. That extra argument is usually the length passed by
value. Sometimes the extra argument is added right after the address
one. Sometimes it is added way at the end of the list of arguments.

I believe there are also some, I believe VMS being one, that pass the
address of a descriptor containing the address of the string and the
length. That is part of the VMS system standard for calling conventions.

But C normally provides no way for the called routine to know how
many arguments there are. It must be somehow coded in the parameters,
such as the number of format descriptors in the first argument to
printf. It would be usual, though not required by the standard,
for a one argument call to work even with ... in the arglist.

-- glen

.



Relevant Pages