delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/09/13:35:24

Mime-Version: 1.0
To: Peter Palotas <blizzar AT hem1 DOT passagen DOT se>, djgpp AT delorie DOT com
From: Nate Eldredge <nate AT cartsys DOT com>
Subject: Re: Exceptions
Date: Sat, 9 May 1998 10:29:57 -0700
Message-ID: <19980509172947.AAE16984@ppp105.cartsys.com>

At 12:52  5/8/1998 -0400, Peter Palotas wrote:
>Hi,
>
>I was wondering what is the diffrence between using the (undocumented)
>switch -fsjlj-exceptions and simply -fexceptions (or no switch since it's
>default)?  Are there any diffrence in speed, or anything else?

Take what I say here with a grain of salt, since most of it is second-hand
or guesswork. I don't know enough C++ nor do I have enough experience with
the GCC sources to answer authoritatively. That said...

AFAIK, the standard `-fexceptions' switch handles exceptions through a
table, which is managed by GCC's library. DJGPP does not yet contain the
startup code to set this up correctly, so it doesn't work.
`-fsjlj-exceptions', as the name implies, handles them with `setjmp' and
`longjmp'. This is simple since their action is very similar to that of
`catch' and `throw'. However, it is not as fast, and I suspect it may also
increase code size.


>Also I wonder generally if exceptions are slow/unefficient, generally
>speaking (meaning that your program should throw as few exceptions as
>possible during execution), or if they can be used frequently without any
>speed degradance....

I don't know, but I suspect that, at least with `-fsjlj', they won't be
particularly fast. In general, I would not expect a strange control transfer
like that done by exceptions to be all that fast.

Nate Eldredge
nate AT cartsys DOT com



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019