Click to See Complete Forum and Search --> : what is (...) in a function decleraiton?


Jasmine St clair
October 1st, 2001, 02:08 AM
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

Jasmine St clair
October 1st, 2001, 02:08 AM
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

sbrothy
October 1st, 2001, 03:26 AM
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! */

sbrothy
October 1st, 2001, 08:53 AM
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! */

ianduff
October 3rd, 2001, 12:51 AM
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.

Dmitry Zemskov
October 3rd, 2001, 07:40 PM
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