Philipp Klaus Krause schreef op 2025-11-26 17:23:
Formally, array parameters (without static) are no different from
pointer parameters. However, they have often been used to express the
intent of the parameter being an array of a certain size.
Do you have any preferences on what SDCC should do? Currently SDCC
does not warn (neither does clang), while GCC sometimes does:
// Tested via gcc/clang -Wall -pedantic -Warray-parameter
-Warray-bounds test.c
void f(char a[4])
{
a[4] = 7; // neither gcc nor clang warn
}
void g(void)
{
char a[3];
f(a); // gcc warns, clang doesn't.
f(0); // neither gcc nor clang warn
}
Would you like to see warnings in SDCC for any of these?
Philipp
I would like to see warnings for both cases.
Maarten
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user