Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: David Allsopp <dra-news@metastack.com>
To: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: RE: [Caml-list] String.create
Date: Wed, 22 Oct 2014 09:27:26 +0000	[thread overview]
Message-ID: <E51C5B015DBD1348A1D85763337FB6D9E9650C20@Remus.metastack.local> (raw)
In-Reply-To: <20141022091439.GA27538@pl-59055.rocqadm.inria.fr>

Sébastien Hinderer wrote:
> OCaml 4.02.0 prints the following warning:
> Warning 3: deprecated: String.create
> 
> The code that triggers this warning looks like this:
> 
> let buf = String.create size in
> really_input ic buf 0 size;
> 
> Is there a way to fix the code so that it does not trigger this warning
> but still compiles also with older versions of Caml, up to 3.10?

Yes - write your code to use Bytes (http://caml.inria.fr/pub/docs/manual-ocaml/libref/Bytes.html) and then add a requirement for findlib >= 1.5 which includes the "bytes" package (this is a dummy package for OCaml >= 4.02 and a compatibility layer for OCaml < 4.02).

Alternatively, if for some very strange reason you're not happy to depend on findlib, you can borrow its compatibility layer directly (src/bytes/bytes.ml) and integrate that into your build system.


David

  parent reply	other threads:[~2014-10-22  9:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-22  9:14 Sébastien Hinderer
2014-10-22  9:26 ` av1474
2014-10-22  9:31   ` David Allsopp
2014-10-22  9:27 ` David Allsopp [this message]
2014-10-22  9:29 ` Sylvain Pogodalla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E51C5B015DBD1348A1D85763337FB6D9E9650C20@Remus.metastack.local \
    --to=dra-news@metastack.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox