Are there gotchas using varargs with reference parameters

前端 未结 6 1956
臣服心动
臣服心动 2020-11-29 08:11

I have this piece of code (summarized)...

AnsiString working(AnsiString format,...)
{
    va_list argptr;
    AnsiString buff;

    va_start(argptr, format);         


        
6条回答
  •  不知归路
    2020-11-29 08:40

    Here's my easy workaround (compiled with Visual C++ 2010):

    void not_broken(const string& format,...)
    {
      va_list argptr;
      _asm {
        lea eax, [format];
        add eax, 4;
        mov [argptr], eax;
      }
    
      vprintf(format.c_str(), argptr);
    }
    

提交回复
热议问题