On Fri, Aug 09, 2024 at 04:03:53PM GMT, Jakub Jelinek wrote:
> E.g. consider GCC
> #define iterative_hash_object(OB,INIT) iterative_hash (&OB, sizeof (OB), INIT)
> macro.
> If one uses it on the function parameters declared as arrays but turned into
> pointers and you know what you are doing, why not.
> If using sizeof in that case is an error, you'd need to know, I can use this
> macro on everything except this special case.

Hmmm, I guess the array updates of
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2906.pdf> and
__lengthof__ supporting array parameters don't need to come with a
change to sizeof.  If one wants to learn the size of an array parameter,
it's easy to define

        #define sizeof_array(a)  (__lengthof__(a) * sizeof(*(a)))

So, please ignore my proposal.

Cheers,
Alex

-- 
<https://www.alejandro-colomar.es/>

Attachment: signature.asc
Description: PGP signature

Reply via email to