Agree, IMHO warning, in this case, is useful.

On Wed, Nov 26, 2025 at 5:51 PM Steve Schnepp <[email protected]> wrote:
>
> For me, more warnings is always better, as the lack if those is what makes C 
> so much error prone.
>
> Any compile time check is worth a thousand runtime checks as it is mostly 
> free.
>
> Cheers,
> --
> Steve Schnepp
>
> "A man is not dead while his name is still spoken."
>     -- T. Pratchett - Going Postal, Chapter 4 prologue
>
> On Wed, Nov 26, 2025, 17:24 Philipp Klaus Krause <[email protected]> wrote:
>>
>> 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
>>
>>
>>
>> _______________________________________________
>> Sdcc-user mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/sdcc-user
>
> _______________________________________________
> Sdcc-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sdcc-user



-- 
BR/Pozdrawiam. Wlodzimierz Lipert


_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to