I have been overseeing these last emails - thank you very much for your
efforts, Alex! I did not reply until now because I do not have prior
experience with gcc internals, so my feedback would probably have not
been that useful.

Those emails from 2020 were in fact discussing two completely different
proposals at once:

1. Add _Lengthof + #include <stdlengthof.h>
2. Allow static qualifier on compound literals

Whereas proposal #2 made it into C23 (kudos to Jens Gustedt!), and as
you already know by now, proposal #1 received some negative feedback,
suggesting _Typeof/typeof + some macro magic as a pragmatic workaround
instead.

Since the proposal did not get much traction and I would had been
unable to contribute to gcc myself, I just gave up on it. IIRC the
deadline for new proposals closed soon after, anyway.

But I am glad that someone with proper experience took the initiative.
I still think the proposal is relevant and has interesting use cases.

> I have only added lengthof for now, not _Lengthof, as suggested by Jens.
> Depending on feedback, I'll propose the uglified version.

Probably, all of us know why the uglified version is the usual approach
preferred by the C standard: we do not know how many applications would
break otherwise.

However, we see that this trend is now changing with C23, so probably
it makes sense to define lengthof directly.

As for the parentheses, I personally think lengthof should follow
similar rules compared to sizeof.

Best regards,

--
Xavier Del Campo Romero



Aug 13, 2024, 15:02 by a...@kernel.org:

> Hi,
>
> On Tue, Aug 13, 2024 at 01:34:58AM GMT, Alejandro Colomar wrote:
>
>> I want to send an updated version of n2529.  The original author didn't
>> respond to my mail, so I'll take over.  I've been preparing a GCC patch
>> set for adding the feature to GCC, and have informed Clang developers
>> about it too.
>>
>> The title would be
>>
>> _Lengthof - New pointer-proof keyword to determine array length (v2)
>>
>> Can you please assign me a number for it?  Thanks.
>>
>
> Attached is a draft for a paper (both the man(7) source and the
> generated PDF).
>
> I have only added lengthof for now, not _Lengthof, as suggested by Jens.
> Depending on feedback, I'll propose the uglified version.
>
> Cheers,
> Alex
>
> --
> <https://www.alejandro-colomar.es/>
>

Reply via email to