|
Message-ID: <20230602173722.7404abd7@inria.fr>
Date: Fri, 2 Jun 2023 17:37:22 +0200
From: Jₑₙₛ Gustedt <jens.gustedt@...ia.fr>
To: Rich Felker <dalias@...c.org>
Cc: musl@...ts.openwall.com, jens.gustedt@...teo.eu
Subject: Re: [C23 printf 2/3] C23: implement the wN length specifiers
for printf
Rich,
on Fri, 2 Jun 2023 11:16:40 -0400 you (Rich Felker <dalias@...c.org>)
wrote:
> Note that this is kinda a problem for scanf where va_arg is used
> with void*, except that POSIX, conveniently, explicitly requires the
> C (compiler) implementation accept mismatched va_arg types when both
> types are pointers.
I think that was a change for C23, we here have something similar in
7.16.1.1
— one type is pointer to qualified or unqualified `void` and the
other is a pointer to a qualified or unqualified character type;
Unfortunately, C can not go easily further than that, because other
than in POSIX there might be data pointers that have different
representations. (We could have said something like pointers with the
same width and representation, though.)
Also for the new `nullptr_t` type we now have
— or, the type of the next argument is `nullptr_t` and type is a
pointer type that has the same representation and alignment
requirements as a pointer to a character type.
Which then makes it defined behavior to pass in a `nullptr` sentinel,
where it previously was UB when `NULL` was for example `OL` or so, or
when the application passed in an explicit zero instead of `NULL`.
Jₑₙₛ
--
:: ICube :::::::::::::::::::::::::::::: deputy director ::
:: Université de Strasbourg :::::::::::::::::::::: ICPS ::
:: INRIA Nancy Grand Est :::::::::::::::::::::::: Camus ::
:: :::::::::::::::::::::::::::::::::::: ☎ +33 368854536 ::
:: https://icube-icps.unistra.fr/index.php/Jens_Gustedt ::
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.