Mention CATCH_MOVE and CATCH_FORWARD in contributing docs

This commit is contained in:
Martin Hořeňovský 2021-08-16 16:20:32 +02:00
parent d2ee7100d2
commit 88c27ffaf2
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
1 changed files with 13 additions and 1 deletions

View File

@ -210,7 +210,7 @@ are problematic and are not always caught by our CI infrastructure.
#### Naked exceptions and exceptions-related function
If you are throwing an exception, it should be done via `CATCH_ERROR`
or `CATCH_RUNTIME_ERROR` in `catch_enforce.h`. These macros will handle
or `CATCH_RUNTIME_ERROR` in `internal/catch_enforce.hpp`. These macros will handle
the differences between compilation with or without exceptions for you.
However, some platforms (IAR) also have problems with exceptions-related
functions, such as `std::current_exceptions`. We do not have IAR in our
@ -219,6 +219,18 @@ However, if you do, they should be kept behind a
`CATCH_CONFIG_DISABLE_EXCEPTIONS` macro.
#### Avoid `std::move` and `std::forward`
`std::move` and `std::forward` provide nice semantic name for a specific
`static_cast`. However, being function templates they have surprisingly
high cost during compilation, and can also have a negative performance
impact for low-optimization builds.
You should be using `CATCH_MOVE` and `CATCH_FORWARD` macros from
`internal/catch_move_and_forward.hpp` instead. They expand into the proper
`static_cast`, and avoid the overhead of `std::move` and `std::forward`.
#### Unqualified usage of functions from C's stdlib
If you are using a function from C's stdlib, please include the header