title: Estimate size of formatted snprintf() string?
body: <p>I'm considering writing a function to estimate at least the full length of a formatted string coming from the sprintf(), snprintf() functions. </p>
  
  <p>My approach was to parse the format string to find the various %s, %d, %f, %p args, creating a running sum of strlen()s, itoa()s, and strlen(format_string) to get something guaranteed to be big enough to allocate a proper buffer for snprintf().</p>
  
  <p>I'm aware the following works, but it takes 10X as long, as all the printf() functions are very flexible, but very slow because if it. </p>
  
  <pre><code>  char c;
    int required_buffer_size = snprintf(&amp;c, 1, "format string", args...);
  </code></pre>
  
  <p><strong>Has this already been done ?</strong> - via the suggested approach, or some other reasonably efficient approach - IE: 5-50X faster than sprintf() variants?</p>