public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Ulrich Drepper via Gcc <gcc@gcc.gnu.org>
Cc: Ulrich Drepper <drepper@redhat.com>
Subject: Re: -Wformat and u8""
Date: Mon, 09 May 2022 11:26:24 +0200	[thread overview]
Message-ID: <87wnevcb0f.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <CAP3s5k93syRYr6v198OBxYgSHajmeZPWc7BNPxxc=WxF9Evpqg@mail.gmail.com> (Ulrich Drepper via Gcc's message of "Mon, 9 May 2022 11:15:44 +0200")

* 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?

Thanks,
Florian


  reply	other threads:[~2022-05-09  9:26 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 [this message]
2022-05-09 10:04   ` Ulrich Drepper
2022-05-09 10:07   ` Andreas Schwab
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=87wnevcb0f.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=drepper@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).