Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Landru! Guide us! -- A Beta 3-oid, "The Return of the Archons", stardate 3157.4


devel / comp.lang.c++ / Coroutines -- destroy the generator before co_return

SubjectAuthor
o Coroutines -- destroy the generator before co_returnFrederick Virchanza Gotham

1
Coroutines -- destroy the generator before co_return

<2b962eeb-f39f-473f-927c-0a44c61d5fd4n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
X-Received: by 2002:a05:620a:28cc:b0:74d:fdca:a6ce with SMTP id l12-20020a05620a28cc00b0074dfdcaa6cemr638216qkp.4.1684505805610;
Fri, 19 May 2023 07:16:45 -0700 (PDT)
X-Received: by 2002:a05:620a:4623:b0:759:1798:d849 with SMTP id
br35-20020a05620a462300b007591798d849mr609102qkb.3.1684505805425; Fri, 19 May
2023 07:16:45 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c++
Date: Fri, 19 May 2023 07:16:45 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=92.40.183.58; posting-account=w4UqJAoAAAAYC-PItfDbDoVGcg0yISyA
NNTP-Posting-Host: 92.40.183.58
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2b962eeb-f39f-473f-927c-0a44c61d5fd4n@googlegroups.com>
Subject: Coroutines -- destroy the generator before co_return
From: cauldwell.thomas@gmail.com (Frederick Virchanza Gotham)
Injection-Date: Fri, 19 May 2023 14:16:45 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1686
 by: Frederick Virchanza - Fri, 19 May 2023 14:16 UTC

Let's say I have a coroutine that works as a generator.

It gives you the letters of the alphabet:

generator<char> GetAlphabet(void);

So let's say I invoke this coroutine and create a generator object, and I use it to get 'a', and then 'b', and then 'c'.

But let's say I then destroy the generator object before the coroutine has invoked 'co_return'. What's supposed to happen here? Is it simply undefined behaviour, or will it behave as though you had re-entered the coroutine and immediately encountered 'co_return'? (meaning that the destructors of stack objects get invoked properly?)

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor