caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Peter Zotov <whitequark@whitequark.org>
To: <caml-list@inria.fr>
Subject: Re: [Caml-list] LLVM OCaml bindings
Date: Wed, 06 Nov 2013 11:06:26 +0400	[thread overview]
Message-ID: <e9170de1263cf3f05ec05fa5ae4a945e@whitequark.org> (raw)
In-Reply-To: <52796387.8070602@gmail.com>

Jacques-Pascal Deplaix писал 06.11.2013 01:30:
> Why LLVM chose to do Asserts instead of raise an exception ?
> Anyways, thanks for your impressive work. I will consider re-switch to
> the official binding if it's finally usable.
> 

Several reasons.

1) C++ exceptions are very costly in terms of space (RTTI), and also in
    terms of time when they're raised. LLVM, striving to be efficient,
    uses neither exceptions nor RTTI.

2) Writing exception-safe C++ code can be very tricky: essentially, one
    needs to make all data structures transactional and ensure that
    any control-flow path, whether it involves exceptions or not, leaves
    them in a valid state.

3) LLVM has about seven thousand assertions. The amount of code 
required
    to gracefully handle all that with exceptions is huge, and since
    asserts most of the time test for conditions presumed impossible,
    how do you test those codepaths?

I agree that an error handling strategy better than puts();abort() 
would
be nice, but I cannot see LLVM using exceptions, either.

-- 
   WBR, Peter Zotov.

  reply	other threads:[~2013-11-06  7:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-05  4:23 Peter Zotov
2013-11-05  8:12 ` Gabriel Kerneis
2013-11-05  8:18   ` Peter Zotov
2013-11-05 11:09 ` Jacques-Pascal Deplaix
2013-11-05 11:32   ` Peter Zotov
2013-11-05 21:00     ` Jeff Meister
2013-11-06  7:19       ` Peter Zotov
2013-11-06  7:54         ` Jeff Meister
2013-11-05 21:30     ` Jacques-Pascal Deplaix
2013-11-06  7:06       ` Peter Zotov [this message]
2013-11-08  9:36 ` Jon Harrop
2013-11-08 10:18   ` Peter Zotov
2013-11-08 11:31     ` Jon Harrop
2013-11-08 11:44       ` Peter Zotov
2013-11-12  3:44       ` Jeff Meister
2013-11-12 14:13         ` Peter Zotov
2013-11-13 19:00           ` Jon Harrop
2013-11-14 16:06             ` Hongbo Zhang
2013-11-14 19:29               ` Jeff Meister

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=e9170de1263cf3f05ec05fa5ae4a945e@whitequark.org \
    --to=whitequark@whitequark.org \
    --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).