Mail Archives: djgpp/1998/05/09/13:35:24
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 -