On Mon, Dec 09, 2024 at 02:44:42PM -0500, David Malcolm wrote:
> +C23 brings the following changes:
> +
> +<h4 id="c23-empty-fn-prototypes-become-void">Function prototypes with empty 
> params change from implicit <code>int</code> to <code>void</code></h4>
> +
> +<p> In C23 <code>()</code> in a function declaration means the same as 
> <code>(void)</code>, whereas previously it implicitly declared the function 
> to take an <code>int</code> parameter.</p>

This isn't true.  void foo (); used to be an unprototyped function,
one could pass any arguments to it (of course without invoking UB
only if it actually matched the arguments passed to it).
So, with
void foo ();
int bar ();
one can
  foo (1, 2.0, 3L, bar (2));
if the definitions were
void foo (int a, double b, long c, int d) {
//...
}
int bar (int e) {
//...
}
or K&R-ish
void foo (f, g, h, i)
  int f;
  double g;
  long h;
  int i;
{
/* ... */
}
void bar (j)
  int j;
{
/* ... */
}

Implicit int was about completely undeclared functions in K&R/C89,
those were assumed to return int.  But we already error on those by
default in C99 and later modes, so no need to describe it again.

        Jakub

Reply via email to