Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.os.vms    |    DEC's VAX* line of computers & VMS.    |    264,096 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 262,709 of 264,096    |
|    =?UTF-8?Q?Arne_Vajh=C3=B8j?= to Lawrence D'Oliveiro    |
|    Re: FreeTDS port to VMS V9.x on x86?    |
|    23 Jun 25 22:10:19    |
      From: arne@vajhoej.dk              On 6/23/2025 9:41 PM, Lawrence D'Oliveiro wrote:       > On Mon, 23 Jun 2025 20:40:21 -0400, Arne Vajhøj wrote:       >> On 6/23/2025 8:37 PM, Lawrence D'Oliveiro wrote:       >>> What a dumb way to do it. Using the null device means making OS I/O       >>> calls -- needless overhead just to find out how long a string -- which       >>> is being put together entirely in userland -- needs to be.       >>       >> But if you have a simple better way of achieving it ...       >       > snprintf(3) and vsnprintf(3) return the total number of bytes needed for       > the final result. So just call them once with all the right arguments and       > a zero-length buffer, and use the result to allocate a buffer of the right       > length, and call them again.              That is a lot better than vfprintf to null.              But it does not solve the problem of multiple v*printf calls.              > And of course you should be using va_end(3) and va_start(3) again before       > the second call. This allows for traversing the argument list multiple       > times.              Yes. But the argument list for vasprintf is as it is. This is       code replacing a missing RTL function with a given argument list.              So calling va_* multiple times means switching from a replacement       function to #ifdef code in calling function (dbfcmd).              Arne              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca