Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Trespassers will be shot. Survivors will be SHOT AGAIN!


devel / comp.lang.c++ / Re: "Functional exception-less error handling with C++23

SubjectAuthor
o Re: "Functional exception-less error handling with C++23Chris M. Thomasson

1
Re: "Functional exception-less error handling with C++23

<u3bove$3vkio$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=66&group=comp.lang.c%2B%2B#66

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: "Functional exception-less error handling with C++23
Date: Mon, 8 May 2023 14:18:36 -0700
Organization: A noiseless patient Spider
Lines: 81
Message-ID: <u3bove$3vkio$1@dont-email.me>
References: <u1pli1$6mq8$1@dont-email.me> <u1rlf3$l84t$1@dont-email.me>
<u1rnfv$licm$1@dont-email.me> <u1rnhe$lifb$1@dont-email.me>
<u1ro4t$lm05$1@dont-email.me> <u1rpmb$ls8k$2@dont-email.me>
<u1tns1$12vei$1@dont-email.me> <u1ts50$13ktv$2@dont-email.me>
<u1u46u$2p6ta$1@dont-email.me> <u1uh5k$2r4vm$2@dont-email.me>
<u208rh$37dmf$1@dont-email.me> <u20fl1$38chq$2@dont-email.me>
<u20rt9$3acec$1@dont-email.me> <u20u93$3apml$1@dont-email.me>
<u211df$3bc3i$1@dont-email.me> <u212ek$3bgnm$1@dont-email.me>
<u25eo3$91h2$1@dont-email.me> <u25fte$96ps$1@dont-email.me>
<209f4f58-4e10-40a2-a397-d33bf630de59n@googlegroups.com>
<u25nt0$ajbd$2@dont-email.me>
<99fa2c91-6195-42df-8d66-cd71e1f3c725n@googlegroups.com>
<f5f2c205-c446-4900-b866-797476693acfn@googlegroups.com>
<853b908a-4b2b-4133-838f-0d5f285d292en@googlegroups.com>
<u29dca$10puk$1@dont-email.me>
<d8f87ef5-20d3-4fae-aff1-5a95462b7149n@googlegroups.com>
<u2ajn8$19q9n$1@dont-email.me>
<5cb09b43-030a-465c-927d-43116a6ed279n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 8 May 2023 21:18:38 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d2c7a55820c79dd175750f71e6ffdaa7";
logging-data="4182616"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+3YnBGshAcOuGdROkTumYgu1yVxABAgEg="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.10.1
Cancel-Lock: sha1:IjEdPkd/UWJzgVWuXcH0fi8Cewo=
Content-Language: en-US
In-Reply-To: <5cb09b43-030a-465c-927d-43116a6ed279n@googlegroups.com>
 by: Chris M. Thomasson - Mon, 8 May 2023 21:18 UTC

On 4/26/2023 3:57 AM, Öö Tiib wrote:
> On Wednesday, 26 April 2023 at 10:26:53 UTC+3, David Brown wrote:
>> On 26/04/2023 07:58, Öö Tiib wrote:
>>> On Tuesday, 25 April 2023 at 23:32:28 UTC+3, Chris M. Thomasson wrote:
>>>> On 4/25/2023 6:58 AM, Öö Tiib wrote:
>>>>> On Tuesday, 25 April 2023 at 16:25:04 UTC+3, Tony Oliver wrote:
>>>>>> On Monday, 24 April 2023 at 14:55:06 UTC+1, Öö Tiib wrote:
>>>>>>> On Monday, 24 April 2023 at 14:07:28 UTC+3, Bonita Montero wrote:
>>>>>>>> Am 24.04.2023 um 12:29 schrieb Öö Tiib:
>>>>>>>>
>>>>>>>>> Programmers tend to have real features to implement and problems
>>>>>>>>> to solve. You failed to tell why they should waste time to doing
>>>>>>>>> beta testing for gradually emerging half-baked C++23 features
>>>>>>>>> instead.
>>>>>>>> It's not about beta-testing.
>>>>>>>> It's about keeping up with what's coming.
>>>>>>>
>>>>>>> I briefly skimmed over that std::expected ... it had no much benefits
>>>>>>> compared to std::variant<Success, Failure>.
>>>>>>
>>>>>> Too briefly, it seems. That analogy with std::variant is way off the mark.
>>>>>>
>>>>> Yes, usage of variant is easier as it has visitors. With that class one got
>>>>> to write if else chain ... that does not differ much from what Chris mocks
>>>>> in other thread.
>>>>
>>>> I was not really mocking the "style", just how some programmers do not
>>>> like it at all... Personally, I don't mind it. Each function has a
>>>> struct for input and a struct for output.
>>>>
>>> OK. I do not hate it but I feel it has same issue with returning std::optional
>>> or std::expected, there is additional copy (or hopefully move) made for
>>> composing such function arguments and return value and so it inhibits the
>>> effect (or works in the opposite direction) of NRVO. Especially on
>>> case of heavy-weight "success" objects passed the performance can
>>> drop after refactoring to it. And performance issue means that the
>>> style can not be used idiomatically/uniformly.
>>
>> In regard to performance issues, you might want to do some testing and
>> measuring.
>
> What is the ground of implication that I do not? You think those are my
> half-educated guesses? Nope. Those are actually reverted commits because
> of proven degradation of performance.
>
>> Small structures on modern processors can be passed and
>> returned in registers in many cases. The use of structs for parameters
>> and return values might limit the compiler's choice of registers and
>> force a bit more register-to-register moves, but these are often almost
>> free in modern processors since they manipulate the register renaming
>> maps rather than actually moving data around.
>>
> Note that I mentioned heavy-weight above.
>
>> Whether or not you like Chris' style or not is a different matter, of
>> course - I'm just saying that it will not necessarily have the
>> performance implications you suggest.
>>
> It sometimes has and sometimes does not have. I'm repeating for
> to point arrive more surely, it cannot be used idiomatically/uniformly.

I have worked on systems that had large input structures. They would be
passed into a function as a const reference. The function would do its
thing, and return a structure that had say a glm::vec3 and a status.
Then I have worked on other systems that had the input and output
structs in the parameters and would return a status in the form of an
unsigned long that had many error conditions packed into said unsigned
value. Kind of like:
____________________
unsigned long
foo(
foo_input const& input,
foo_output& output
) {
// whatever
return 0; // or some status value
} ____________________

Output can be written to, input is constant, and it would return a
status unsigned long to the caller.


devel / comp.lang.c++ / Re: "Functional exception-less error handling with C++23

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor