Date: Fri, 11 Aug 2023 15:25:53 +0200
pt., 11 sie 2023 o 15:17 Breno Guimarães via Std-Proposals
<std-proposals_at_[hidden]> napisał(a):
>
> Does it work for cases where there are multiple named objects?
>
> std::mutex foo(bool b)
> {
> std::mutex m1, m2;
> if (b)
> return m1;
> else
> return m2;
> }
>
>
This should be a hard error and not allowed.
Only code like:
```
std::mutex foo(bool b)
{
if (b)
{
std::mutex m1;
return m1;
}
std::mutex m2;
return m2;
}
```
should be only allowed. Any return object should not overlap as there is only
one return "slot" where the compiler creates an object.
> Em sex., 11 de ago. de 2023 10:02, Frederick Virchanza Gotham via Std-Proposals <std-proposals_at_[hidden]> escreveu:
>>
>> I've written a paper on ensuring the elision of a move/copy operation
>> when returning a class by value from a function. C++17 already ensures
>> elision when it comes to Return Value Optimisation (RVO), but not when
>> it comes to Named Return Value Optimisation (NRVO).
>>
>> Of the 27 platforms this is tested and working on, I've had to write
>> implementations in assembler for 4 of them: arm64, m68k, hppa, sh4.
>>
>> I could spend another month on this paper but I need to think
>> "progress not perfection" and release a draft. In the next draft I'll
>> deal with:
>> (1) Ensuring correct use of 'noexcept' with
>> std::function<void(void)noexcept>
>> (2) Use concepts or SFINAE to make sure the class is nonmovable
>> and noncopyable
>> No. 2 is important because some of the calling conventions will return
>> in registers unless the class is unmovable and uncopyable.
>>
>> I have 27 workflows up on Github which show it tested and working on
>> various operating systems, compilers and CPU's:
>> https://github.com/healytpk/nrvo
>>
>> The PDF file of my paper is attached to this email, and you can also
>> download the latest draft from:
>>
>> http://virjacode.com/downloads/nrvo/paper_nrvo_latest.pdf
>>
>> File attached: paper_nrvo_draft001.pdf
>> --
>> Std-Proposals mailing list
>> Std-Proposals_at_[hidden]
>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
<std-proposals_at_[hidden]> napisał(a):
>
> Does it work for cases where there are multiple named objects?
>
> std::mutex foo(bool b)
> {
> std::mutex m1, m2;
> if (b)
> return m1;
> else
> return m2;
> }
>
>
This should be a hard error and not allowed.
Only code like:
```
std::mutex foo(bool b)
{
if (b)
{
std::mutex m1;
return m1;
}
std::mutex m2;
return m2;
}
```
should be only allowed. Any return object should not overlap as there is only
one return "slot" where the compiler creates an object.
> Em sex., 11 de ago. de 2023 10:02, Frederick Virchanza Gotham via Std-Proposals <std-proposals_at_[hidden]> escreveu:
>>
>> I've written a paper on ensuring the elision of a move/copy operation
>> when returning a class by value from a function. C++17 already ensures
>> elision when it comes to Return Value Optimisation (RVO), but not when
>> it comes to Named Return Value Optimisation (NRVO).
>>
>> Of the 27 platforms this is tested and working on, I've had to write
>> implementations in assembler for 4 of them: arm64, m68k, hppa, sh4.
>>
>> I could spend another month on this paper but I need to think
>> "progress not perfection" and release a draft. In the next draft I'll
>> deal with:
>> (1) Ensuring correct use of 'noexcept' with
>> std::function<void(void)noexcept>
>> (2) Use concepts or SFINAE to make sure the class is nonmovable
>> and noncopyable
>> No. 2 is important because some of the calling conventions will return
>> in registers unless the class is unmovable and uncopyable.
>>
>> I have 27 workflows up on Github which show it tested and working on
>> various operating systems, compilers and CPU's:
>> https://github.com/healytpk/nrvo
>>
>> The PDF file of my paper is attached to this email, and you can also
>> download the latest draft from:
>>
>> http://virjacode.com/downloads/nrvo/paper_nrvo_latest.pdf
>>
>> File attached: paper_nrvo_draft001.pdf
>> --
>> Std-Proposals mailing list
>> Std-Proposals_at_[hidden]
>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2023-08-11 13:26:05