RedditPP Mascot

RedditPP

r/C_Programming • … • u/Linguistic-mystic

One of the coolest features of C: omitted parameter names

In all programming languages, there are places where you need to write a function with some parameters that are unused. Mostly to satisfy some callback signature or functional interface. But C makes it easiest of all languages. Where in other languages you have to give the compiler hints like `@SuppressWarnings("unused")` or `name _: String` to prevent it from warning you that this parameter here is unused, in C you can just omit the parameter name:

void foo(int arg, char*) { ...implemenation }

That's it, no hints, no warnings (even with `-Wextra`), no nuthin'. The compiler understands that if you haven't given this parameter a name, then you intend it to be unused. This is the most concise of all languages and you don't even have to come up with a (useless) name.

— 0