caml-list - the Caml user's mailing list
 help / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: caml-list@inria.fr
Subject: [Caml-list] overflow checks on `int` operations
Date: Wed, 10 Jul 2019 16:36:01 -0400
Message-ID: <jwvlfx5k4xt.fsf-monnier+gmane.comp.lang.caml.inria@gnu.org> (raw)

What's the "standard" way to perform arithmetic operations on `int` with
overflow checking (e.g. returning an `Option` or signaling an
exception on overflow)?

Currently I do the checks by hand but it occurred to me that maybe I'm
not the first one to want that.


        Stefan


PS: I'm not looking to have all arithmetic on `int` with overflow
checks: only some specific uses of them.


             reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-10 21:26 Stefan Monnier [this message]
2019-07-10 23:05 ` Glen Mével
2019-07-11  6:43   ` Gabriel Scherer
2019-07-12 18:58     ` Stefan Monnier

Reply instructions:

You may reply publically 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=jwvlfx5k4xt.fsf-monnier+gmane.comp.lang.caml.inria@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --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

caml-list - the Caml user's mailing list

Archives are clonable: git clone --mirror https://inbox.ocaml.org/caml-list

AGPL code for this site: git clone https://public-inbox.org/ public-inbox