Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Bonita Montero Newsgroups: comp.lang.c++ Subject: Re: "C++20 Coroutines" by Martin Bond Date: Sat, 25 Sep 2021 12:18:09 +0200 Organization: A noiseless patient Spider Lines: 26 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 25 Sep 2021 10:18:09 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="f61e0663b04488e36f72c12ad3990597"; logging-data="4686"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18in3xcqk/KESLzjK6NuLQ+30KzUSwJNv0=" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 Cancel-Lock: sha1:pQV7LnRWhWBtcKM+gOD5RjhPwFM= In-Reply-To: Content-Language: de-DE Xref: csiph.com comp.lang.c++:81542 Am 25.09.2021 um 12:09 schrieb HorseyWorsey@the_stables.com: >> Am 25.09.2021 um 11:19 schrieb HorseyWorsey@the_stables.com: >>> No sane person would use coroutines instead of a nice clear state machine. >> >> State-machines are never clear ! You've to write a >> while( state != END ) >> switch( state ) >> { >> case STATE_A: >> ... >> break; >> case STATE_B: >> ... >> break; >> case STATE_C: >> ... >> break; >> } >> -loop and that's _much_ less readable. With C++-coroutines you have the control-flow of a normal func- tion between the states. That's much more readable than the above spaghetti-code. That's while fibers have been invented, but their overhead is much larger and they're not integrated in the langauage and thereby not so convenient.