diff options
| author | Martin Hořeňovský | 2021-08-16 16:20:32 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2021-08-16 16:22:21 +0200 |
| commit | 88c27ffaf22b41cfb35400c86b38078e2f7b494b (patch) | |
| tree | 618448df7c87908f91678fea89a966b4be82b6d3 /docs/contributing.md | |
| parent | d2ee7100d26128b3956571cc802f3a52c9b9aea8 (diff) | |
| download | catch3-88c27ffaf22b41cfb35400c86b38078e2f7b494b.tar.gz | |
Mention CATCH_MOVE and CATCH_FORWARD in contributing docs
Diffstat (limited to 'docs/contributing.md')
| -rw-r--r-- | docs/contributing.md | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/docs/contributing.md b/docs/contributing.md index 9a85f76a..dc6bb537 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -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 |