(Variable Arguments,...)

This is a discussion on (Variable Arguments,...) within the C Programming forums, part of the General Programming Boards category; Hi. I have two functions. They both take variable arguments lists. I want to merge the two into one. But ...

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

    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:
    if( numeric_limits< byte >::digits != bits_per_byte )
        error( "program requires bits_per_byte-bit bytes" );
    24bbs.cpp

  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,600
    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:
    if( numeric_limits< byte >::digits != bits_per_byte )
        error( "program requires bits_per_byte-bit bytes" );
    24bbs.cpp

  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, 08: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, 12:25 PM
  5. Core Dump with Variable Arguments
    By penney in forum C Programming
    Replies: 1
    Last Post: 06-20-2003, 10:11 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21