Exceptions

From: Eric (ericjhart_at_yahoo.com)
Date: 02/19/04


Date: 19 Feb 2004 09:14:53 -0800

I have been researching how exceptions and dynamic_cast work to
determine if I will use either feature for a game-console application.
 I have a few pre-concieved notions and questions that I was hoping
some people here could validate/answer.

PRECONCEIVED NOTION #1: Common implementations of dynamic_cast<>
(VC++, GCC) rely on the presence of type_info objects. The use of
strcmp() instead of type_info pointer-equivalence in common
implementations is used ONLY to support non-statically linked
applications (.dll's & such). Other than this requirement,
dynamic_cast<> conceptually would never need the type_info::name
strings. typeid(), on the other hand, must have type_info::name
strings to fulfill it's function regardless of whether the app is
entirely statically linked or not.

QUESTION #1: Given that I am writing a statically-linked game-console
app and I am only interested in dynamic_cast and not typeid(), it
would benefit me to not have type_info::name strings added to my app
and have dynamic_cast implemented using type_info pointer equivalence.
 Can gcc do this??

PRECONCEIVED NOTION #2: Exception handling (the more attractive
feature to me) actually requires dynamic_cast<> to implement the
catch-by-type mechanism, which in turn requires strcmp() to support
non-statically linked apps, which in turn requires a full
type_info::name string for every type in my code regardless of whether
or not it is ever thrown.

QUESTION #2: Given that this amounts to unnecessary size-bloat for my
statically linked game-console app, does anyone know if gcc can
implement catch-by-type using type_info pointer equivalence and
suppress the type_info::name strings?

PRECONCEIVED NOTION #3: The best implementations of exception handling
out there use the zero-runtime-cost model (I understand that VC++ does
not, but gcc does). I understand that this model has no performance
penalties when not throwing because the stack is unwound using an
exteral table of ip-sorted elements rather than inserting code into
every function. In addition to the typename strings that are
theoretically irrelevant to statically linked apps, zero-runtime-cost
models also have to add this instruction-pointer table to the app, and
the table must cover every single function in the code regardless of
whether or not it throws.

QUESTION #3: Can anyone characterize the structure of the elements in
such a table so that I can get my head around the size implications of
it? Is there one entry per instantiation of objects with actual
destructors?

Thanks for any insight you can give on any of these issues.

-Eric



Relevant Pages

  • Re: Application xxx has encountered a serious error and must shut
    ... Chris Tacke, Embedded MVP ... use of Queueacross multiple threads - and even my exception ... stopped my Serial port thread - last time it stopped the whole app:-O. ... NB I replaced the MS SerialPort with OpenNetCF Serial and this seems ...
    (microsoft.public.windowsce.app.development)
  • Re: Exception management question...
    ... There is code in my app that follows this general pattern: ... This allows an exception to be thrown with the next line of code attempts to ... >> to propagate up to a global exception handler which logs the exception ... > has determined that the app should terminate the UE handler has no means ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: SqlceException.SqlceException
    ... First of all, i found the cause of the exception and corrected it, it was ... > same challenge in terms of deploying the initial SQL CE database. ... > db along with your app. ... it is the first time i am doing mobile applications and the first ...
    (microsoft.public.sqlserver.ce)
  • Re: wtf?
    ... > called by the ASP classic app, ... >> other than error translation. ... > exception that comes from the command's execute method doesn't seem to ... > the time we might be content saying "SqlException", in this case, we ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: strong key problems
    ... it is not clear what you are actually trying to accomplish by somehow ... i - how to create a strong key and use it in your applications. ... iv - any referencer to any app with strong name must also have a strong ... Unhandled Exception: System.Security.SecurityException: That assembly ...
    (microsoft.public.dotnet.languages.csharp)