Variable Params in C++

Discussion in 'OT Technology' started by Shaggy007, May 7, 2004.

  1. Shaggy007

    Shaggy007 New Member

    Joined:
    Oct 22, 2003
    Messages:
    901
    Likes Received:
    0
    Location:
    In the Springtime of my youth
    I'm aware that this is possible but I haven't been able to find any documentation on how to actually do this other than the arbitrary line of "You can do this", in books. It's basically telling a function to take whatever number of variables it gets passed, it's available in Lisp as just a "..." declaration. I was just wondering how the implementation looks in C++, if anyone can swing it my way I'd apreciate it.
     
  2. StevesVR4

    StevesVR4 Get Arrested

    Joined:
    Jul 1, 2003
    Messages:
    7,328
    Likes Received:
    0
    In C++, variable arguments are also declared with "..." at the end of the parameter list. To access the arguments, you need to use the va_args() function. Search some online C++ documents to get a description of how to use the function and what is necessary to set it up.
     
  3. Shaggy007

    Shaggy007 New Member

    Joined:
    Oct 22, 2003
    Messages:
    901
    Likes Received:
    0
    Location:
    In the Springtime of my youth
    Thanks for the info :bigthumb:
     

Share This Page