Hi All
what is (...) in a function decleraiton?
e.g.
int __cdecl printf(const char *, ...);
is it standard C?
can i declare a function that can
accept diffrent number of argument in standard C (not C++)?
thanx
Printable View
Hi All
what is (...) in a function decleraiton?
e.g.
int __cdecl printf(const char *, ...);
is it standard C?
can i declare a function that can
accept diffrent number of argument in standard C (not C++)?
thanx
Yes. See MSDN: "va_arg, va_end, va_start".
Regards,
S. Bro
/* I would be happy to deal with my problems one at the time if they would only line up! */
You might want to take a look at this MSDN article:
"Reduce EXE and DLL Size with LIBCTINY.LIB"
It gives instructions for writing your own "printf" function (see "Figure 2") to reduce the size of your executable (or DLL) and uses the variable argument list.
Regards,
S. Bro
/* I would be happy to deal with my problems one at the time if they would only line up! */
The (...) is called an elipse and indicates that the function takes a variable number of parameters.
It is standard "C".
Look at va_start, va_end, va_sprintf, etc as covered by one of the other replies.
BTW - here is one of the differences between C & C++ - in C Foo()
means any params, for no params we should use Foo( void )
in C++ Foo()
means NO PARAMS exactly