title: Replacement for MS _vscprintf on MacOS/Linux?
body: <p>As a learning experience I'm porting some stuff from Windows to MacOS and came across something like this:</p>
  
  <pre><code>void SomeClass::someFunction(const char* format, va_list args)
  {
      int size = _vscprintf(format, args); // length after formatting
      std::string s;
      s.resize(size);
      vsprintf(&amp;s[0]);
      ...
  }
  </code></pre>
  
  <p>Now, as _vscprintf is Microsoft specific and I haven't found anything similar on Linux I thought I'd ask here.</p>
  
  <p>Let's also assume this code is in some critical path and shouldn't have some extra overhead of heap allocation or such.</p>
  
  <p><strong>What is the recommended replacement for _vscprintf on MacOS/Linux?</strong></p>
  
  <p>Thanks!</p>