Skip to content

remove incorrect throw() function specification#39

Merged
dthuerck merged 2 commits into
dthuerck:masterfrom
modriplanetdoo:fix-throw
May 3, 2023
Merged

remove incorrect throw() function specification#39
dthuerck merged 2 commits into
dthuerck:masterfrom
modriplanetdoo:fix-throw

Conversation

@mitjap
Copy link
Copy Markdown
Contributor

@mitjap mitjap commented Apr 21, 2023

throw() keword in incorrectly used. I can see it is meant to specify which function MAY throw but this specifier does the opposite. It specifies that this function will never throw and if it does it will cause application termination.

A dynamic exception specification whose set of adjusted types is empty (after any packs are expanded) (since C++11) is non-throwing. A function with a non-throwing dynamic exception specification does not allow any exceptions.

If the function throws an exception of the type not listed in its exception specification, the function std::unexpected is called. The default function calls std::terminate, ....

https://en.cppreference.com/w/cpp/language/except_spec
https://en.cppreference.com/w/cpp/language/noexcept_spec

@dthuerck
Copy link
Copy Markdown
Owner

dthuerck commented May 3, 2023

Thanks - much appreciated!

@dthuerck dthuerck merged commit 6a9eac8 into dthuerck:master May 3, 2023
@mitjap mitjap deleted the fix-throw branch May 8, 2023 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants