public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Gavin Ray <ray.gavin97@gmail.com>
Cc: Richard Biener <richard.guenther@gmail.com>,
	Andrew Pinski <pinskia@gmail.com>,
	 "gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: Bug with GCC's handling of lifetimes of implicit-lifetime types
Date: Mon, 12 Dec 2022 11:56:39 +0000	[thread overview]
Message-ID: <CAH6eHdTbjH=RrrDGEYaLFbiWg3DQvpaVofm_wCxrAfPQtWTN_A@mail.gmail.com> (raw)
In-Reply-To: <CAFtvWZO-xemEhRx=i-hob2Tfz0YHPxM-uzjHDMEtx5DFWPVoyw@mail.gmail.com>

On Sun, 11 Dec 2022 at 13:44, Gavin Ray wrote:
>
> Whoops, the last line should be pages_span(storage, ...)

That won't even compile, so there's your main difference.

That seems even more off-topic on this list than "somebody told me gcc
is broken, because of [unrelated code example with UB]".

A creates 'pages' objects in the storage, B doesn't compile, but even
if it did, it's just saying "look at this storage as though it
contained this many objects of type 'pages'" which doesn't create any
objects, and would be a lie.


>
> On Sun, Dec 11, 2022 at 8:38 AM Gavin Ray <ray.gavin97@gmail.com> wrote:
>>
>> @Richard
>>
>> That's some intense code, I appreciate the code-samples and explanation, thank you =)
>>
>> @Jonathan
>>
>> Maybe there was some misunderstanding?
>> I didn't make the connection either but I also don't know that much about C++
>>
>> It seems like that expression is valid then? Good to know =)
>>
>> As a random aside if I may -- what is the difference between placement-new of pointers in
>> std::byte storage, and making a std::span over the storage area?
>>
>> std::byte storage[PAGE_SIZE * NUM_PAGES];
>>
>> // A)
>> page* pages = new (storage) page[NUM_PAGES];
>> // B)
>> std::span<page, NUM_PAGES> pages_span(pages, NUM_PAGES);

      reply	other threads:[~2022-12-12 11:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-10 17:41 Gavin Ray
2022-12-10 18:35 ` Jonathan Wakely
2022-12-10 18:43   ` Andrew Pinski
2022-12-10 21:48     ` Gavin Ray
2022-12-11  9:11     ` Richard Biener
2022-12-11 12:02       ` Jonathan Wakely
2022-12-11 13:31         ` Richard Biener
2022-12-11 13:38           ` Gavin Ray
2022-12-11 13:44             ` Gavin Ray
2022-12-12 11:56               ` Jonathan Wakely [this message]

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='CAH6eHdTbjH=RrrDGEYaLFbiWg3DQvpaVofm_wCxrAfPQtWTN_A@mail.gmail.com' \
    --to=jwakely.gcc@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=pinskia@gmail.com \
    --cc=ray.gavin97@gmail.com \
    --cc=richard.guenther@gmail.com \
    /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).