Warning C26455
Default constructor should not throw. Declare it '
noexcept
' (f.6)
The C++ Core Guidelines suggest that default constructors shouldn't do anything that can throw. When the default constructor can throw, all code that relies on a properly instantiated object may also throw.
Remarks
Consider the default constructors of the STL types, like std::vector
. In these implementations, the default constructors initialize internal state without making allocations. In the std::vector
case, the size is set to 0 and the internal pointer is set to nullptr
. The same pattern should be followed for all default constructors.
Code analysis name: DEFAULT_CTOR_NOEXCEPT
See also
Зворотний зв’язок
https://aka.ms/ContentUserFeedback.
Очікується незабаром: протягом 2024 року ми будемо припиняти використання механізму реєстрації проблем у GitHub для зворотного зв’язку щодо вмісту й замінювати його новою системою зворотного зв’язку. Докладніше:Надіслати й переглянути відгук про