79540433

Date: 2025-03-28 03:04:30
Score: 0.5
Natty:
Report link

Visual Studio likes to warn you when it thinks that one of your functions could be declared 'noexcept' but isn't. Annoyingly, it can sometimes do this for virtual functions which are defined in a base class to do nothing, even though a derived class might be intended to override the function to throw exceptions.

Using noexcept(false) on the base class function declaration and definition can prevent this warning from being generated. (Using "#pragma warning (suppress: C26440)" on the function definition is another approach, and one that I personally find preferable.)

See https://developercommunity.visualstudio.com/t/c26440-can-be-declared-noexcept-generated-for-virt/292031

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Some Guy