From: Andreas Schwab <schwab@linux-m68k.org>
To: Florian Weimer via Gcc <gcc@gcc.gnu.org>
Cc: Florian Weimer <fweimer@redhat.com>,
Ulrich Drepper <drepper@redhat.com>
Subject: Re: -Wformat and u8""
Date: Mon, 09 May 2022 12:07:11 +0200 [thread overview]
Message-ID: <87levbkoj4.fsf@igel.home> (raw)
In-Reply-To: <87wnevcb0f.fsf@oldenburg.str.redhat.com> (Florian Weimer via Gcc's message of "Mon, 09 May 2022 11:26:24 +0200")
On Mai 09 2022, Florian Weimer via Gcc wrote:
> * Ulrich Drepper via Gcc:
>
>> t.cc: In function ‘int main()’:
>> t.cc:5:24: warning: format string is not an array of type ‘char’ [-Wformat=]
>> 5 | printf((const char*) u8"test %d\n", 1);
>> | ^~~~~~~~~~~~~
>
> This is not an aliasing violation because of the exception for char,
> right? So the warning does not even highlight theoretical undefined
> behavior.
>
> On the other hand, that cast is still quite ugly. All string-related
> functions in the C library currently need it. It might obscure real
> type errors. Isn't this a problem with char8_t?
In C++20, u8 literals have a distinct type, which is an incompatible
change from C++17.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
next prev parent reply other threads:[~2022-05-09 10:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-09 9:15 Ulrich Drepper
2022-05-09 9:26 ` Florian Weimer
2022-05-09 10:04 ` Ulrich Drepper
2022-05-09 10:07 ` Andreas Schwab [this message]
2022-05-10 13:27 ` Jonathan Wakely
2022-05-10 17:48 ` Tom Honermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87levbkoj4.fsf@igel.home \
--to=schwab@linux-m68k.org \
--cc=drepper@redhat.com \
--cc=fweimer@redhat.com \
--cc=gcc@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).