Date: Wed, 29 Nov 2023 07:46:58 -0300
I don't think that's UB. Not calling the destructor is not UB.
Em qua., 29 de nov. de 2023 07:40, Giuseppe D'Angelo via Std-Proposals <
std-proposals_at_[hidden]> escreveu:
> Il 29/11/23 11:28, Frederick Virchanza Gotham via Std-Proposals ha scritto:
> > But of course the details of my project aren't particularly relevant
> > here on this mailing list -- the principle here is that sometimes,
> > although rarely, you want to just give up on an object and forget
> > about destroying it.
>
> Jonathan Wakely already gave you the solution: allocate it on the heap,
> and then leak it if things to wrong.
>
> > For now I think I'll just do:
> >
> > memset( &obj.value(), 0, sizeof obj.value() ); // not needed
> > but paranoia is good
> > ::new( &obj.value() ) std::future<bool>();
>
> This is outright UB. That's nowhere an acceptable tradeoff.
>
> My 2 c,
> --
> Giuseppe D'Angelo
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
Em qua., 29 de nov. de 2023 07:40, Giuseppe D'Angelo via Std-Proposals <
std-proposals_at_[hidden]> escreveu:
> Il 29/11/23 11:28, Frederick Virchanza Gotham via Std-Proposals ha scritto:
> > But of course the details of my project aren't particularly relevant
> > here on this mailing list -- the principle here is that sometimes,
> > although rarely, you want to just give up on an object and forget
> > about destroying it.
>
> Jonathan Wakely already gave you the solution: allocate it on the heap,
> and then leak it if things to wrong.
>
> > For now I think I'll just do:
> >
> > memset( &obj.value(), 0, sizeof obj.value() ); // not needed
> > but paranoia is good
> > ::new( &obj.value() ) std::future<bool>();
>
> This is outright UB. That's nowhere an acceptable tradeoff.
>
> My 2 c,
> --
> Giuseppe D'Angelo
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
Received on 2023-11-29 10:47:10