lundi 25 avril 2016

'va_start' used in function with fixed args error

My nullPointcheck function:

template<typename T, typename... Args>
bool __nullPointCheck(T first, Args... args)
{
    bool ret = true;
    va_list vl;
    auto n = sizeof...(args);
    va_start(vl, n);
    for (auto i = 0; i <= n; ++i)
    {
        auto p = va_arg(vl, T);
        if (!p)
        {
            ret = false;
        }
    }
    va_end(vl);
    return ret;
}

but I'm getting the ndk build error as follows:

'va_start' used in function with fixed args
va_start(vl, n);

when I change the second param in va_start to first as follows:

va_start(vl, first);

ndk-build export the error as follows:

     'va_start' used in function with fixed args
    va_start(vl, first);
    ^
E:/ANDROID_HOME/android-ndk-r10c/toolchains/llvm-3.5/prebuilt/windows-x86_64/bin
\..\lib\clang\3.5\include\stdarg.h:33:29: note:
expanded from macro 'va_start'
#define va_start(ap, param) __builtin_va_start(ap, param)

There are no errors in vs2013, but the code can's pass ndk-build stage

Aucun commentaire:

Enregistrer un commentaire