Hi Collin, On Mon, Jun 02, 2025 at 06:10:35PM -0700, Collin Funk wrote: > Hi all, > > Bruno Haible via Gnulib discussion list <[email protected]> writes: > > >> > BTW, do you have in plans for using this module within gnulib itself? > > > > Sure. I'll just wait a week or so > > - to give other people a chance to chime in, > > - to wait for the weekly CI results. > > Alejandro, I did not read all the documentation, so feel free to point > me in the right direction if this is an answered question. But why > standardize "_Countof" instead of "countof"? > > I was excited that C23 added the keywords non-funky keywords. As far as > I am aware, there was no issues caused by making "alignof" and "alignas" > a keyword,
There was a transition period of more than a decade for alignof/as, and of more than two decades for bool. It gave time to programs to stop defining it in their source code. It was assumed in C23 that few people would be defining their own bool and alignof/as. However, it would have been impossible to do that without the transition period. For countof, we couldn't have standardized it right away either, because people are using it currently. So we also had to use a transition period, where it is provided in a header. People should update their code to only define it if it is not defined by the compiler, and define it with compatible semantics. Then, in C3y/C4x we'll be able to make it a keyword. > replacing the ugly "_Alignas" and "_Alignof". As for the uglyness, I didn't consider it ugly, and I would have added just _Countof without a "nice" macro. We already have precedent for that in _Generic(3). But some people in the committee wanted the macro, so we added it. > I hope that we can keep that naming convention in C99/C11. I'll give > _BitInt and _DecimalXX an exception. And _Generic(3). :) > It looks useful otherwise, thanks. Thanks! :-) BTW, there's 3 more operators in the oven, which I expect will be approved in August for C2y: _Widthof, _Minof, and _Maxof. <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3518.txt> The feedback from the C Committee has been good so far. I don't have a header in mind for those operators, but I might add it as <stdwidth.h> if the committee wants one. Now that I think, it is useful as a feature test, because it's easy to check if the header and macro exist from within the source code itself. Have a lovely day! Alex > Collin -- <https://www.alejandro-colomar.es/>
signature.asc
Description: PGP signature
