C++ exceptions and performace

Okay, ladies and gents, is there any way to efficently combine c++ exceptions with ogl and still have good performace?

see, i first imagined that if there’s only try/catch blocks around the areas of code that aren’t time critical, it wouldn’t affect the areas that are, i.e. my RENDERING code.

well, woe is me, because as soon as you click the check box for your project that says to enable exceptions, everything boggs, and i don’t know why…

anyway, i want to use exceptions w/ my ogl code, at least near it, so does anyone know of some way to selectively enable/disable it for different sections of code (#pragma, i’d imagine)

is there anyone who has actually done this sucessfully? (speculation takes soo much more time than proven fact… )

please, lemino, but please don’t bust on me if using exceptions isn’t ogl"pc"

-hopefull in pa

I wouldn’t touch 'dem exception thingies with a ten-foot pole.

Sometimes they’re required, like with file mappings where what was formerly a file read or write error suddenly becomes a program crash, but I do all my error checking in my programs the old-fashioned way. If I need to catch an exception generated by the CPU, that’s the only exception [ha ha ha] I’ll make to that rule.

  • Matt

Matt is right, don’t touch exception except in loading code where speed is not that important.

How about wrapping the main code in a single catchall?

With Borland compilers you can enable/ disable exceptions using
#pragma option -x
#pragma option +x
But I agree with the other guys: Deactivate exceptions and be happy!

Exceptions are a powerful tool for
EXCEPTIONAL cases. Typical implementations
of exceptions will cost nothing (0) when
you pass a “try” sentinel, but will cause
massive paging, loading of exception tables,
and all other kinds of nastiness if you
actually, god forbid, throw an exception.

Do not, repeat NOT, use exceptions for flow
control. Except for exceptional

If there’s some issue with the runtime libs
on your platform when you enable exceptions,
you may wish to disassemble the code
generated by your compiler and see what’s
going on.