Promote -Wno-sizeof-array-argument to an error
Martin Uecker
uecker@tugraz.at
Thu Aug 8 07:31:37 GMT 2024
Am Donnerstag, dem 08.08.2024 um 02:36 +0200 schrieb Alejandro Colomar:
> Hi Martin,
>
> Can we promote -Wno-sizeof-array-argument to a hard error? I don't
> think there's any legitimate use sizeof() on such a parameter.
I am a bit worried that it might prevent people from adding size information
to arguments, by transforming later use of sizeof on such a pointer argument
into a hard error.
So I would not do this at this time, until we have fully evolved the
size checking and the benefits are clear.
>
> It would be an incompatible extension to ISO C, which would make sure
> that there are no remaining uses of sizeof(array_param), which would
> itself allow in the future --if n2906 or something similar is accepted--
> repurposing sizeof() to return the size in bytes of the array (instead
> of the size of a pointer) without worrying about breaking existing code.
I agree with this goal, but this is a long term goal.
Martin
>
More information about the Gcc
mailing list