3 ms·
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'
by _kst_ 5mo 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.
- userbinator 5mo agoThis is a site for intellectual curiosity, not pedantic dissmisal.
- _kst_ 5mo agoSeriously? I discussed some of the technical issues behind the article. If you disagree with anything I wrote, please say so. I'm not even saying that the issues discussed in the article aren't useful, just going into how likely they're likely to be encountered in practice.
- themafia 5mo agoHacker News does not like actual hackers.
- themafia 5mo agoWait. Isn't the thing you're doing right here _exactly_ "pedantic dismissal?" Looking at your comment history that seems to be _your_ mode.
- themafia 5mo agoYou could also use inline assembly.
- FartyMcFarter 5mo 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. This article is exclusively about undefined behaviour. "Bad code" is already baked into the assumptions of the article.