Skip to content

Commit 10d94c5

Browse files
committed
Add docs for Callback config
Documentation for changes in ARMmbed/mbed-os#12036
1 parent 033f3ed commit 10d94c5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/api/platform/Callback.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ void run_timer_event(Callback<void(float)> on_timer) {
2626

2727
The Callback class is what’s known in C++ as a “Concrete Type”. That is, the Callback class is lightweight enough to be passed around like an int, pointer or other primitive type.
2828

29+
## Configuration
30+
31+
Two system configuration options permit trade-offs between image size and flexibility of the Callback class.
32+
33+
* `platform.callback-nontrivial` controls whether Callbacks can store non-trivially-copyable function objects. Having this setting off saves significant code size, as it makes Callback itself trivially-copyable, so all Callback assignments and copies are simpler. Almost all users use Callback only with function pointers, member function pointers or lambdas with trivial captures, so this setting can almost always be left set to false. A compile-time error will indicate that this setting needs to be set to true if any code attempts to assign a non-trivially-copyable object to a Callback.
34+
35+
* `platform.callback-comparable` controls whether two Callbacks can be compared to each other. The ability to support this comparison increases code size whenever a Callback is assigned, whether or not any such comparison occurs. Turning the option off removes the comparison operator and saves a little image size.
36+
37+
<span class="tips">**Tip:** See the documentation of the [Arm Mbed configuration system](../reference/configuration.html) for more details about `mbed_app.json`. </span>
38+
2939
## Callback class reference
3040

3141
[![View code](https://www.mbed.com/embed/?type=library)](https://os.mbed.com/docs/mbed-os/development/mbed-os-api-doxy/classmbed_1_1_callback.html)

0 commit comments

Comments
 (0)