Is the following code correct in terms of freeing up resources?
#include <exception>

struct A {
  ~A() { throw std::exception(); }
};
Explanation
No, because an exception thrown from the destructor can lead to an incomplete release of resources occupied by the object (in this case, the memory, and if A was inherited from another class, there would be a resources leak, since its destructor would not be called).

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Cosmo
Зареєструйся Зараз
або Підпишись на майбутні тести