Promote -Wno-sizeof-array-argument to an error

Alejandro Colomar alx@kernel.org
Thu Aug 8 00:36:33 GMT 2024


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.

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.

Any opinions?

Have a lovely night!
Alex

-- 
<https://www.alejandro-colomar.es/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20240808/d65169d6/attachment.sig>


More information about the Gcc mailing list