Liste des Groupes | Revenir à co vms |
On Tue, 24 Jun 2025 12:25:50 -0400, Arne Vajhøj wrote:The specific factor is not as important as using multiplication insteadThe algorithm is basically to try vsnprintf with buffers increasing inIt’s a good choice in the absence of any other clues as to how much to
size 512, 1024, 1536, ... until there is space.
>
That is very inefficient compared to just use the return value.
allocate. I have used it myself. (Of course having an explicit number
returned is best of all.)
One may conduct statistical analyses, I suppose to decide on the optimum
multiplication factor. E.g. would going up in powers of 3 better than
powers of 2? I suspect larger factors (too far from e = 2.71828 ...) would
not be worth using.
And don’t forget to do a realloc(3) at the end, to trim the unused part ofThat seems very natural.
the last allocation.
Les messages affichés proviennent d'usenet.