13 AĞUSTOS 2012, PAZARTESİ
Özel sınıflar standart C kütüphanesinde ne var
Standart C kütüphanesi, içerdiği özel sınıflar nelerdir ve onlar için kullanılan ne olmalıdır? Birkaç yeni C 11 istisnalar vardır biliyorum, ama ne olduklarını ya da nerede emin değilim.
CEVAP
13 AĞUSTOS 2012, PAZARTESİ
std::exception <exception> interface (debatable if you should catch this)
std::bad_alloc <new> failure to allocate storage
std::bad_array_new_length <new> invalid array length
std::bad_cast <typeinfo> execution of an invalid dynamic-cast
std::bad_exception <exception> signifies an incorrect exception was thrown
std::bad_function_call <functional> thrown by "null" std::function
std::bad_typeid <typeinfo> using typeinfo on a null pointer
std::bad_weak_ptr <memory> constructing a shared_ptr from a bad weak_ptr
std::logic_error <stdexcept> errors detectable before the program executes
std::domain_error <stdexcept> parameter outside the valid range
std::future_error <future> violated a std::promise/std::future condition
std::invalid_argument <stdexcept> invalid argument
std::length_error <stdexcept> length exceeds its maximum allowable size
std::out_of_range <stdexcept> argument value not in its expected range
std::runtime_error <stdexcept> errors detectable when the program executes
std::overflow_error <stdexcept> arithmetic overflow error.
std::underflow_error <stdexcept> arithmetic underflow error.
std::range_error <stdexcept> range errors in internal computations
std::regex_error <regex> errors from the regular expression library.
std::system_error <system_error> from operating system or other C API
std::ios_base::failure <ios> Input or output error
Kaynak: http://en.cppreference.com/w/cpp/error/exception
Uygulamada, en özel durumlar özel durumlar logic_error
runtime_error
türetilmiştir. Birçok etki alanı özel özgü bu ihmal değil, ama.
Bir istisna neyin yanlış gittiğini yansıtmalıdır . unutmayın ^em>değilkim düzenledi. (Hayır, ""s) MyProgramException
Bunu Paylaş:
Nasıl Standart uyumlu özel ISO C new v...
C özel istisnalar uygulanması için sta...
Nasıl özel yöntemleri, alanları veya i...
Nasıl Özel Sınıf tüm sınıflar özniteli...
İç sınıflar özel değişkenleri erişebil...