caml-list - the Caml user's mailing list
 help / color / mirror / 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	[thread overview]
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	other threads:[~2019-07-10 21:26 UTC|newest]

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

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=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
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;
as well as URLs for NNTP newsgroup(s).