On Fri, Aug 09, 2024 at 03:25:00PM +0200, Alejandro Colomar wrote:
> The problem with that is that the error will still be enforced _after_
> GCC would change the behavior of sizeof(aparam).

I don't think it should unless C2Y requires that.

> Admittedly, I could write configure checks to determine if I have a
> version of GCC where sizeof(aparam) is bad and only enable the error
> there.
> 
> > but there is nothing wrong about using sizeof on function
> > argument with array type if you know what you're doing,
> 
> I have doubts here.  Does anyone have an idea of what kind of program
> would be interested in that value?

Any time you use some macro on such parameters where the macro internals use
sizeof for whatever reason.
E.g. if it wants to cast the pointer to some integer type and decides based
on sizeof what integer type that would be, ...
I mean, what you are suggesting is similar to making an error from
sizeof (char), that is by definition 1, so there is no point for users to
use it.  It makes sense in macros...

        Jakub

Reply via email to