X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4c39aa3a6582f06a4aae8023ad1c2c862b1ab35d..a1c3cdc4a2c4cc2b15d7fdf60c1be228f9fbc520:/docs/latex/wx/texcept.tex diff --git a/docs/latex/wx/texcept.tex b/docs/latex/wx/texcept.tex index 5b2139877f..58344d0ddb 100644 --- a/docs/latex/wx/texcept.tex +++ b/docs/latex/wx/texcept.tex @@ -1,6 +1,6 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Name: texcept.tex -%% Purpose: C++ exceptions and wxWindows overview +%% Purpose: C++ exceptions and wxWidgets overview %% Author: Vadim Zeitlin %% Modified by: %% Created: 17.09.03 @@ -11,25 +11,25 @@ \section{C++ exceptions overview}\label{exceptionsoverview} -\subsection{Introduction} +\subsection{Introduction}\label{exceptionintroduction} -wxWindows had been started long before the exceptions were introduced in C++ so -it is not very surprizing that it is not built around using them as some more +wxWidgets had been started long before the exceptions were introduced in C++ so +it is not very surprising that it is not built around using them as some more modern C++ libraries are. For instance, the library doesn't throw exceptions to signal about the errors. Moreover, up to (and including) the version 2.4 of -wxWindows, even using the exceptions in the user code was dangerous because the +wxWidgets, even using the exceptions in the user code was dangerous because the library code wasn't exception-safe and so an exception propagating through it could result in memory and/or resource leaks, and also not very convenient. -Starting from the version 2.5.1 wxWindows becomes more exception-friendly. It +Starting from the version 2.5.1 wxWidgets becomes more exception-friendly. It still doesn't use the exceptions by itself but it should be now safe to use the exceptions in the user code and the library tries to help you with this. Please note that making the library exception-safe is still work in progress. -\subsection{Strategies for exceptions handling} +\subsection{Strategies for exceptions handling}\label{exceptionstrategies} -There are several choice for using the exceptions in wxWindows programs. First +There are several choice for using the exceptions in wxWidgets programs. First of all, you may not use them at all. As stated above, the library doesn't throw any exceptions by itself and so you don't have to worry about exceptions at all unless your own code throws them. This is, of course, the simplest solution but @@ -46,7 +46,7 @@ add a try/catch clause around the call of the base class version. This would allow you to catch any exceptions generated during the execution of the main event loop. To deal with the exceptions which may arise during the program startup and/or shutdown you should insert try/catch clauses in -\helpref{OnInit()}{wxapponinit} and/or \helpref{OnExit()}{wxappoxexit} as well. +\helpref{OnInit()}{wxapponinit} and/or \helpref{OnExit()}{wxapponexit} as well. Finally, you may also want to continue running even when certain exceptions occur. If all of your exceptions may happen only in the event handlers of a @@ -57,7 +57,7 @@ the \helpref{wxApp::HandleEvent()}{wxapphandleevent} which allows you to handle all the exceptions thrown by any event handler. -\subsection{Technicalities} +\subsection{Technicalities}\label{exceptionstechnicalities} To use any kind of exception support in the library you need to build it with \texttt{wxUSE\_EXCEPTIONS} set to $1$. This should be the case by default but