I guess I'm not modern enough to feel comfortable using alloca (or variable-length arrays) in my code :-)

On Sat, Dec 3, 2016 at 2:36 PM, Richard W.M. Jones <rich@annexia.org> wrote:
On Sat, Dec 03, 2016 at 03:00:57PM +0100, immanuel litzroth wrote:
> Yes, I've used that solution too, keeping a static fixed string around,
> it's just not very nice and will break if it's ever multithreaded.

You shouldn't make the string static, and we do *not* do that in
libguestfs.  You should simply allocate it on the stack.  This is
thread safe.

Also on the bug it was stated:

> The stack-based solutions rely on guessing arbitrary size limits on
> the dynamic strings, which is often possibles but sometimes
> inconvenient/inelegant.

but this is not true either.  You can use alloca to allocate a
variable sized string on the stack.

As Xavier Leroy says, fixing this is not necessary, although there's
perhaps a usability argument.

Rich.

--
Caml-list mailing list.  Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs