1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/event: change example in doc to be type safe

C is not a particularly safe language, but let's at least encourage
best practices so that the few safety features C have are effectively
used.
This commit is contained in:
Marian Buschsieweke 2024-05-29 11:05:14 +02:00
parent a2259db3bd
commit 00db1dfc81
No known key found for this signature in database
GPG Key ID: 77AA882EC78084E6

View File

@ -75,13 +75,13 @@
*
* static void custom_handler(event_t *event)
* {
* custom_event_t *custom_event = (custom_event_t *)event;
* custom_event_t *custom_event = container_of(event, custom_event_t, super);
* printf("triggered custom event with text: \"%s\"\n", custom_event->text);
* }
*
* static custom_event_t custom_event = { .super.handler = custom_handler, .text = "CUSTOM EVENT" };
*
* [...] event_post(&queue, (event_t *)&custom_event)
* [...] event_post(&queue, &custom_event.super)
* ~~~~~~~~~~~~~~~~~~~~~~~~
*
* @{