Join Nostr
2026-06-04 16:07:49 UTC

Paul on Nostr: TIL: A hacky but legal way to temporarily suppress a warning about an unused function ...

TIL: A hacky but legal way to temporarily suppress a warning about an unused function parameter in C is to write a statement casting it to void but not assigning the result to anything, e.g.

void parse_present(const char * const input)
{
(void) input;
}

Helpful if you're doing Test Driven Development and want to test the minimal function (e.g. returning an empty / default data structure) without writing all the code.

Works with: clang -Wall -Wextra -Werror -Wpedantic --std=c99

#C