c++ forward function call

后端 未结 3 1336
独厮守ぢ
独厮守ぢ 2021-01-26 19:01

Is it possible to transfer list of parameters of a function , to another function?

For example in my functionA I want to call my functionB/functionC (depends on the stat

3条回答
  •  旧时难觅i
    2021-01-26 19:37

    If you have only longs in your va_args that can work.

    int functionA(int a, ...){
        va_list listPointer;
        va_start( listPointer, a);
        long b = va_arg(listPointer, long);
        long c = va_arg(listPointer, long);
        long d = va_arg(listPointer, long);
        va_end(listPointer);
        return functionB(b, c, d);
    }
    

提交回复
热议问题