This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Native interface question.
- To: egcs at egcs dot cygnus dot com
- Subject: Re: Native interface question.
- From: Marc Espie <espie at quatramaran dot ens dot fr>
- Date: Mon, 10 May 1999 23:33:15 +0200
In article <199905102039.NAA19103@kankakee.wrs.com> you write:
>> From: David Pettersson <dapet@mai.liu.se>
>> I hope this is not the wrong place to ask this question.
>I am sorry, it is. There are books on C programming, classes on C
>programming, and mailing lists and newsgroups all on C programming.
>Any of these types of resources is better.
>> I want to make a piece of C++ code that calls a C function with an
>> previously unknown number of arguments (e.g. scanf). The number of
>> arguments that are sent to the C function is calculated in the C++
>> function it is called from. Is there some way to do this, like
>> sending an array instead or something?
>Sorry, this isn't portable. You can't really do it the way you want.
Slight digression, but that's why all varargs functions in standard C
have a corresponding v* form that takes an array, and why modern
implementations usually implement the varargs form in terms of the
array...
... so get any half-decent source to the standard functions (that does
not include glibc, I'm afraid... this source is there to make you insane
looking for stuff through oodles of defines :-) ), and use the same
technique.
and I'm going to stress again that this is completely off-topic for
this list, comp.lang.c.moderated and comp.lang.c++.moderated are fine.