Thread: (Variable Arguments,...)

  1. #1
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708

    Question (Variable Arguments,...)

    Hi. I have two functions. They both take variable arguments lists. I want to merge the two into one. But is this possible?

    I have not attempted anything yet but I just got the idea that maybe if the new function was set up to accept the first variable arguments till it reached a NULL then the remaining arguments would be for the second VA list?

    Possible?

    Thanks in advance for any input on this.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    That is a very interesting situation. You can make more than one list in a function.
    Code:
    void whatever(char* something, ...){
          va_list list1, list2;
          // code
    }
    I'm not sure if that helps. If i were you I'd play with it and see what you can do.

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Well I would like to call it from the program ...like this:
    Code:
    twoVAfunc(num, string, VA1a, VA1b, VA1c, NULL, VA2a, VA2b, VA2c);
    ...etc.

    Anyway, I try out my NULL idea.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  4. #4
    Ethereal Raccoon Procyon's Avatar
    Join Date
    Aug 2001
    Posts
    189
    It's hard to tell exactly what you want from your post and pseudocode. Perhaps you should post the prototypes of the two functions you want to synthesize to give us a better idea about what you want to do.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Functions with variable argument count..
    By 39ster in forum C++ Programming
    Replies: 3
    Last Post: 04-11-2009, 09:18 AM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  4. Problem with a char variable set as a letter
    By 7smurfs in forum C++ Programming
    Replies: 6
    Last Post: 12-10-2004, 01:25 PM
  5. Core Dump with Variable Arguments
    By penney in forum C Programming
    Replies: 1
    Last Post: 06-20-2003, 10:11 AM