kitschen <[EMAIL PROTECTED]> writes:
> Is it possible in g++ (3.2) to compile without exception handling?
> (turn off all exceptions)
Sure: -fno-exceptions
> I would like to estimate the performance gain on my code without
> exception. Is this possible without rewriting the code and taking out
> all try and catch etc?
Try/catch compiles fine with '-fno-exceptions' (which was a surprize
to me) with g++ 3.3.3; but not with any other version of gcc I tried;
must be a bug in 3.3.3 ...
Throw doesn't compile with g++ 3.3.3 either.
Obviously, if you are *using* exceptions, you can't just tell the
compiler "ignore what I wrote, and compile something else instead".
You might as well try to compile output from /dev/random.
If you want to experimentally disable exceptions, you have to do
it with macros. Something like:
#if EXCEPTIONS_WANTED
# define TRY try
# define CATCH(a) catch (a)
#else
# define TRY if(1)
# define CATCH(a) else if (0) {
#endif
...
TRY { something(); } CATCH(int x) { handle_exception(); }
You'll need to get more creative if handle_exception() needs to
reference 'x'.
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
_______________________________________________
help-gplusplus mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gplusplus