[riot-notifications] [RIOT-OS/RIOT] sys/ps: Improve robustness against string table errors. (#10977)

Marian Buschsieweke notifications at github.com
Sat Feb 23 12:53:17 CET 2019

maribu commented on this pull request.

> @@ -43,6 +43,28 @@ static const char *state_names[] = {
     [STATUS_COND_BLOCKED] = "bl cond",
+#define STATE_NAMES_NUMOF ((int)(sizeof(state_names)/sizeof(state_names[0])))

Maybe it is better to keep `STATE_NAMES_NUMOF` and have something like:

_Static_assert(STATE_NAMES_NUMOF == STATUS_NUMOF, "Missing entry in state_names")

This would be a compile time check like @kaspar030 suggested and for any non-correct `thread_t` data structure it would then be sufficient to use the current stringification code. (That is, not adding a wrapper function to save ROM.)

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190223/aee69b6a/attachment.html>

More information about the notifications mailing list