exception-specification Questions

1

This code compiles on gcc and msvc but not with clang from C++20 on: #include <type_traits> class IBase { protected: IBase() noexcept = default; public: virtual ~IBase() noexcept = defa...
Redfin asked 21/9 at 16:27

5

Solved

I am trying to compile my project with new GCC version 7.2.1 and have a problem with dynamic exception specifications: error: ISO C++1z does not allow dynamic exception specifications MEMORY_ALLO...
Curculio asked 14/11, 2017 at 11:31

1

In C++14 Sec 15.4;2 it is stated, that ... An exception-specification shall not appear in a typedef declaration or alias-declaration. That means the following is forbidden: typedef void (*fn)(int...
Tenedos asked 29/1, 2019 at 17:26

1

Solved

Consider these two possible definitions for a class: Exhibit A: struct A { A() = delete; }; Exhibit A′: struct A { A() noexcept = delete; } Is there any point in declaring a deleted functi...

1

Solved

C++14 standard defines the find() member functions of std::map as follows: iterator find(const key_type& x); const_iterator find(const key_type& x) const; Why are these functions not def...
Haileyhailfellowwellmet asked 6/1, 2016 at 16:52

3

In C++11, a destructor without any exception specification is implicitly declared with noexcept, which is a change from C++03. Therefore, a code which used to throw from destructors in C++03 would ...
Roche asked 5/10, 2015 at 19:26

2

I just read that in the C++11 standard revision, exception specifications were deprecated. I previously thought specifying what your functions may throw is good practice, but apparently, not so. A...
Paz asked 27/8, 2013 at 17:11

3

Solved

I know that this feature will be deprecated in C++0x, but for me as a total novice it seems like a good idea to have it. Could anyone explain to me why isn't a good idea?
Burhans asked 23/3, 2010 at 16:32

2

Solved

I have 2 questions about non-throwing functions: Why make a function non-throwing? How to make a function non-throwing? If the code inside the function actually may throw, then should I still mak...
Prepare asked 7/8, 2012 at 8:27

1

Solved

I've been using Howard Hinnant's stack allocator and it works like a charm, but some details of the implementation are a little unclear to me. Why are global operators new and delete used? The al...

2

Suppose I have: class Foo { public: virtual ~Foo()=default; }; What is the exception-specification on the defaulted destructor? Is the defaulted destructor equivalent to: virtual ~Foo() {}; o...
Shovelboard asked 24/5, 2012 at 4:25

2

Solved

std::exception requires that its constructor be throw(). Yet std::runtime_error accepts a std::string as its argument, which indicates that it's storing a std::string somewhere. Therefore, an assig...
Rastus asked 28/7, 2011 at 18:40

1

Solved

I have an exception class as follows: #include <exception> struct InvalidPathException : public std::exception { explicit InvalidPathException() {} const char* what() const; }; const cha...
Nicoline asked 26/11, 2010 at 4:44

1

Solved

The C++ Standard states the following about virtual functions that have exception specifications: If a virtual function has an exception-specification, all declarations, including the definition...
Opprobrious asked 12/7, 2010 at 23:32

2

Solved

I recently got a dll that has been implemented by others. I have to use it in my application. In the header file of their class they have the function declaration void func1() throw (CCustomExcep...
Revision asked 29/6, 2010 at 13:6

2

Solved

Consider the following code: class A { public: virtual void f() throw ( int ) { } }; class B: public A { public: void f() throw ( int, double ) { } }; When compiled, it says that derived cla...
Exhibition asked 5/3, 2010 at 15:5

11

Solved

I have seen problems when using C++ code that, unexpectedly to the caller, throws an exception. It's not always possible or practical to read every line of a module that you are using to see if it ...
Weasner asked 11/8, 2009 at 16:42
1

© 2022 - 2024 — McMap. All rights reserved.