From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: Jonathan Wakely via Gcc <gcc@gcc.gnu.org>,
peter0x44 <peter0x44@disroot.org>
Subject: Re: Differences between clang and gcc handling of int[static n] function arguments
Date: Wed, 24 May 2023 10:26:37 +0100 [thread overview]
Message-ID: <CAH6eHdQaEBZAaiRFimYy6e0xOwvx+ciEzXcV6YmKK8Gu=KENUQ@mail.gmail.com> (raw)
In-Reply-To: <87sfbmxfnf.fsf@oldenburg.str.redhat.com>
On Wed, 24 May 2023 at 10:06, Florian Weimer wrote:
>
> * Jonathan Wakely via Gcc:
>
> >> It seems it might even be trivial enough for me to investigate and
> >> tackle myself, in some spare time.
> >>
> >> I see very little code using either of these features, so it's
> >> definitely not a high priority task regardless.
> >>
> >
> > Glibc uses the nonnull attribute in many places. Libstdc++ uses it in a few
> > places.
>
> Note that the glibc uses are frequently incompatible with libstdc++
Do you mean incompatible with libstdc++ specifically, or incompatible
with "common C++ idioms"?
> (std::vector in particular). Unfortunately, there is no consensus to
> fix this. For example, one issue is that
>
> memset(vec.data(), 0, sizeof(decltype(vec)::value_type) * vec.size())
>
> isn't necessarily defined even for vectors of POD type.
It's not really idiomatic C++ code anyway. Why would you write that, instead of:
vec.assign(vec.size(), {});
or:
std::fill_n(vec.begin(), vec.size(), range_value_t<decltype(vec)>:{});
?
(The latter optimizes to the ideal code, but I think I know how to
make the former optimize to the same thing.)
next prev parent reply other threads:[~2023-05-24 9:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-21 23:40 peter0x44
2023-05-23 17:47 ` Jonathan Wakely
2023-05-24 9:06 ` Florian Weimer
2023-05-24 9:26 ` Jonathan Wakely [this message]
2023-05-24 9:42 ` Florian Weimer
2023-05-24 9:51 ` Jonathan Wakely
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='CAH6eHdQaEBZAaiRFimYy6e0xOwvx+ciEzXcV6YmKK8Gu=KENUQ@mail.gmail.com' \
--to=jwakely.gcc@gmail.com \
--cc=fweimer@redhat.com \
--cc=gcc@gcc.gnu.org \
--cc=peter0x44@disroot.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).