Skip to content

Commit b2eb55b

Browse files
kjbraceyiriark01
andauthored
Add docs for Callback config (#1185)
* Add docs for Callback config Documentation for changes in ARMmbed/mbed-os#12036 * "left set to false" -> "set to false" Make more ambiguous about default, as there's currently a pending change. Co-Authored-By: Irit Arkin <[email protected]> Co-authored-by: Irit Arkin <[email protected]>
1 parent b2f8bdc commit b2eb55b

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
@@ -28,6 +28,16 @@ You can reset Callbacks to empty by assigning `nullptr`.
2828

2929
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.
3030

31+
## Configuration
32+
33+
Two system configuration options permit trade-offs between image size and flexibility of the Callback class.
34+
35+
* `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 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.
36+
37+
* `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.
38+
39+
<span class="tips">**Tip:** See the documentation of the [Arm Mbed configuration system](../reference/configuration.html) for more details about `mbed_app.json`. </span>
40+
3141
## Callback class reference
3242

3343
[![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)