On Thu, 8 Oct 2026, Alejandro Colomar wrote:

> > My suggestion would be to be strict on the new feature (e.g. disallow 
> > _Countof for any parameter for which both a forward declaration and 
> > another declaration of the parameter are visible) rather than adding extra 
> > checks for consistency of forward parameter declarations.
> 
> That'd be unacceptable for me.  I need to be able to use _Countof() on
> arrays that have been forward declared.
> 
> Here's are a couple of examples:
> 
>       char *
>       vseprintf(char dst[], const char end[];
>           char dst[dst?end-dst:0], const char end[0], const char *restrict 
> fmt, va_list ap)

Then the strict semantics could be for e.g. using _Countof for a parameter 
where a forward declaration gives an array length.

> But we could have a different constraint which I'd find acceptable:
> 
> -  Disallow declaring any array length expressions within a forward
>    declaration of a parameter.
> 
>       void f(int a[42]; int a[]);     // constraint violation
>       void g(int a[42]; int a[42]);   // constraint violation
>       void g(int a[]; int a[42]);     // ok

I think restricting the new feature in such cases would be better than 
restricting forward declarations themselves in such cases.

-- 
Joseph S. Myers
[email protected]

Reply via email to