Promote -Wno-sizeof-array-argument to an error
Joseph Myers
josmyers@redhat.com
Fri Aug 9 14:00:44 GMT 2024
On Fri, 9 Aug 2024, Alejandro Colomar via Gcc wrote:
> Since I don't see any legitimate uses of sizeof(aparam) as of today, I
> don't expect having any consequences on existing code. (But please
> point me wrong if there are any, maybe in generic macros.)
It's perfectly legitimate when the user knows what they are doing - i.e.,
when they know the argument is a pointer and write a sizeof call with that
in mind (rather than under the misapprehension that they would get the
size of an array) but have written it as an array because that is also
useful for some reason (e.g. writing as an array to use [static]).
I repeat what I said yesterday: GCC should not be opinionated about
promoting personal ideas of what is or is not good style or what might or
might not be a future language feature.
(Yes, I disagree with various choices made in man-pages to promote
particular ideas about possible future language features. I don't want
GCC to go in such an opinionated direction.)
--
Joseph S. Myers
josmyers@redhat.com
More information about the Gcc
mailing list