CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2000
    Location
    NY
    Posts
    324

    what is (...) in a function decleraiton?

    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



  2. #2
    Join Date
    Nov 1999
    Location
    Copenhagen, Denmark
    Posts
    265

    Re: what is (...) in a function decleraiton?

    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! */





    Best regards,
    S. Bro

    "I would be happy to deal with my problems one at the time if they would only line up!"
    -Paul Cilwa, "Borland C++ Insider".

    Other useful fora some of which I ruthlessly clipboarded from other peoples footers.

    MSDN: http://search.microsoft.com/us/dev/default.asp
    WIN 32 Assembler: http://board.win32asmcommunity.net/
    RDBMS: http://www.dbforums.com
    Robert's Perl Tutorial: http://www.sthomas.net/roberts-perl-tutorial.htm
    Merriam-Webster Online: http://www.m-w.com/home.htm
    Writing Unmaintainable Code: http://mindprod.com/unmain.html

  3. #3
    Join Date
    Nov 1999
    Location
    Copenhagen, Denmark
    Posts
    265

    Re: what is (...) in a function decleraiton?

    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! */





    Best regards,
    S. Bro

    "I would be happy to deal with my problems one at the time if they would only line up!"
    -Paul Cilwa, "Borland C++ Insider".

    Other useful fora some of which I ruthlessly clipboarded from other peoples footers.

    MSDN: http://search.microsoft.com/us/dev/default.asp
    WIN 32 Assembler: http://board.win32asmcommunity.net/
    RDBMS: http://www.dbforums.com
    Robert's Perl Tutorial: http://www.sthomas.net/roberts-perl-tutorial.htm
    Merriam-Webster Online: http://www.m-w.com/home.htm
    Writing Unmaintainable Code: http://mindprod.com/unmain.html

  4. #4
    Join Date
    May 2001
    Posts
    4

    Re: what is (...) in a function decleraiton?

    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.


  5. #5
    Join Date
    Sep 2000
    Location
    Russia
    Posts
    262

    Re: what is (...) in a function decleraiton?

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured