Date: Tue, 12 Aug 2025 09:23:15 +0200
On 12.08.25 08:46, Martin Uecker wrote:
> It certainly does in C:
> https://godbolt.org/z/bGPM8K4br
Quoting the example here for easier reference:
int foo(int n, char buf[n]);
int main()
{
char buf[100];
foo(101, buf);
}
gcc with -Wall gives a warning (not an error) and clang is silent.
That makes me wonder about the state of standardization
of this situation: Could you point me to the C rule that
specifies how the above should be handled? Given that 101
is a constant, does C make the above ill-formed?
Jens
> It certainly does in C:
> https://godbolt.org/z/bGPM8K4br
Quoting the example here for easier reference:
int foo(int n, char buf[n]);
int main()
{
char buf[100];
foo(101, buf);
}
gcc with -Wall gives a warning (not an error) and clang is silent.
That makes me wonder about the state of standardization
of this situation: Could you point me to the C rule that
specifies how the above should be handled? Given that 101
is a constant, does C make the above ill-formed?
Jens
Received on 2025-08-12 07:23:22