diff --git a/docs/api/platform/Callback.md b/docs/api/platform/Callback.md index 21a95681e1..84fc4f13b4 100644 --- a/docs/api/platform/Callback.md +++ b/docs/api/platform/Callback.md @@ -14,7 +14,7 @@ void run_timer_event(Callback on_timer) { } ``` -The only thing to watch out for is that the Callback type has a null Callback, just like a null function pointer. Uninitialized callbacks are null and assert if you call them. If you want a call to always succeed, you need to check if it is null first. +The only thing to watch out for is that the Callback type has an empty Callback, just like a null function pointer. Default initialized callbacks are empty and assert if you call them. If a callback may be empty, you need to check if it is empty before calling it. ``` c++ void run_timer_event(Callback on_timer) { @@ -24,6 +24,8 @@ void run_timer_event(Callback on_timer) { } ``` +You can reset Callbacks to empty by assigning `nullptr`. + 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. ## Callback class reference