Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1030575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:43:20+00:00 2026-05-16T12:43:20+00:00

I saw someone’s C++ code has function declaration like below: void information_log( const char*

  • 0

I saw someone’s C++ code has function declaration like below:

void information_log( const char* fmt , ...)

or catch block like

catch(...)
{
}

What does “…” mean?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T12:43:21+00:00Added an answer on May 16, 2026 at 12:43 pm

    The ellipsis ..., in a function prototype, is used to denote the function as variadic. That is, it enables a variable number of arguments to be passed into the function. In this form, a function must define some way for the user to specify exactly how many arguments they presented, since the variadic library functions in C++ can’t determine this information dynamically.

    For example, the stdio function printf is one such function with the prototype:

    int printf(const char *format, ...);
    

    Presumably, from the similarities between the two prototypes, the information_log function you describe is designed to mirror much of printf‘s functionality and perhaps even internally uses printf, or one of its cousins.

    The following is an example of how to implement a variadic function:

    // cstdarg provides access to the arguments passed to the ellipsis
    #include <cstdarg> // or (#include <stdarg.h>)
    #include <cstdio>
    #include <cstring>
    
    // Concatenates as many strings as are present
    void concatenate(char ** out, int num_str, ...)
    {
        // Store where the arguments are in memory
        va_list args;
    
        // Find the first variadic argument, relative to the last named argument
        va_start(args, num_str);
    
        int out_len = 0;
        int * lengths = new int[num_str];
        char ** strings = new char*[num_str];
    
        // Extract the strings from the variadic argument list
        for(int i = 0; i < num_str; i++)
        {
            // Specify the position in the argument list and the type
            // Note: You must know the type, stdarg can't detect it for you
            strings[i] = va_arg(args, char *);
            lengths[i] = strlen(strings[i]);
            out_len += lengths[i];
        }
    
        // Concatenate the strings
        int dest_cursor = 0;
        (*out) = new char[out_len + 1];
        for(int i = 0; i < num_str; i++)
        {
            strncpy( (*out) + dest_cursor, strings[i], lengths[i]);
            dest_cursor += lengths[i];
        }
        (*out)[dest_cursor] = '\0';
    
        // Clean up
        delete [] strings;
        delete [] lengths;
        va_end(args);
    }
    
    int main()
    {
        char * output = NULL;
    
        // Call our function and print the result
        concatenate(&output, 5, "The ", "quick", " brown ", "fox ", "jumps!\n");
        printf("%s", output);
    
        delete [] output;
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I saw someone using this in one answer: void methodA(const int*& var); I couldn't
I saw someone's code in View/car.html.haml like followows: %body =yield Can anybody explain me
I saw someone writing code like this , in a C++ class: int foo
I just saw someone post the following, in a rant on ugly code: public
I recently saw someone with a T-shirt with some Perl code on the back.
I saw this code on someone else's website, but found no reference to it
I was looking at someone's code and saw that he repeatedly declared PrintStream out
I was reviewing some code and I saw someone do a if (0 ==
I saw someone using label as an ItemRenderer for DataGrid, the code is here.
Here is my code structure, that I saw from someone else and am trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.