Re: Draft C2Y _BitInt related proposals

Martin Uecker <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha,gmane.comp.gcc.devel
Message-ID <[email protected]>
Am Mittwoch, dem 08.07.2026 um 15:19 +0200 schrieb Florian Weimer:
> * Jakub Jelinek via Gcc:
> 
> > As I wrote earlier, I'd like to see _BitInt I/O support in
> > *printf*/*scanf* and extending support of _BitInt in stdbit.h
> > in C2Y.
> > 
> > For those I wrote drafts of possible C2Y papers:
> > https://jakubjelinek.github.io/wg14/va_arg_bitint.html
> > https://jakubjelinek.github.io/wg14/stdbit_bitint.html
> > 
> > I'd appreciate any comments on this.
> 
> Is this going in the right direction, though?
> 
> Why shouldn't programmers be able to write %d in the format string and
> print _BitInt arguments this way?
> 
> I think it's time to pass a type descriptor for varags functions.  Then
> it wouldn't be necessary to pass the _BitInt size as argument to
> va_arg_bitint.

I agree that this would be the right overall direction.  I want
type descriptors for C anyway for various reasons.  It is a 
bigger project though and seems a bit orthogonal to supporting
_BitInts properly with the current mechanism.

Btw the fmt library now also has some C support, where you can
write

print("The value is {}\n", 488);

it is based on _Generic not type descriptors though.
With Jakub's built-ins could potentially be extended to _BitInts
as well.

https://github.com/fmtlib/fmt/blob/main/include/fmt/fmt-c.h

Martin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.