|
|
|
|
|
by _kst_
54 days ago
|
|
It's not even possible to pass too few arguments to a function in C unless you go out of your way to write bad code. You can write a function declaration that's inconsistent with its definition in another translation unit. Declaring the function in a shared header file avoids this. You can use an old-style declaration that doesn't specify what parameters a function expects. Don't do that. Use prototypes. You can use a cast to convert a function pointer to an incompatible type, and call through the resulting pointer. Don't do that. You can call a function with no visible declaration if your compiler overly permissive or is operating in pre-C99 mode. Don't do that. |
|
This article is exclusively about undefined behaviour. "Bad code" is already baked into the assumptions of the article.