From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: Florian Weimer via Gcc <gcc@gcc.gnu.org>,
Florian Weimer <fweimer@redhat.com>,
Ulrich Drepper <drepper@redhat.com>
Subject: Re: -Wformat and u8""
Date: Tue, 10 May 2022 14:27:12 +0100 [thread overview]
Message-ID: <CAH6eHdRFxHYe_sAQgvswX+Owpzhw_bh0MNsD++o9bVc-OePR9Q@mail.gmail.com> (raw)
In-Reply-To: <87levbkoj4.fsf@igel.home>
On Mon, 9 May 2022 at 11:09, Andreas Schwab wrote:
>
> 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.
And the recommended way to deal with it is to use a cast as Ulrich did.
next prev parent reply other threads:[~2022-05-10 13:27 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
2022-05-10 13:27 ` Jonathan Wakely [this message]
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=CAH6eHdRFxHYe_sAQgvswX+Owpzhw_bh0MNsD++o9bVc-OePR9Q@mail.gmail.com \
--to=jwakely.gcc@gmail.com \
--cc=drepper@redhat.com \
--cc=fweimer@redhat.com \
--cc=gcc@gcc.gnu.org \
--cc=schwab@linux-m68k.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).