Menu

C++20 Coroutines

2020-11-12
2020-11-12
  • David Ledger

    David Ledger - 2020-11-12

    Gday all!
    C++20 is here and coroutines are now reality in GCC, Clang and MSVC.
    Has there been any effort to add coroutines to the project?

    I've had a go myself to add coroutines seems like just adding "co_return" wherever "return" is, ignoring co_await symbol entirely and treating whatever it awaits like a normal function that returns whatever the awaitable's await_return function returns. I've just added in "co_return" across the project. If anybody else has any reports of similar efforts, that'd be awesome.

    I don't really know what the process is here, or source forge in general... So I might need some help there if I'm going to contribute to the project...

     

    Last edit: David Ledger 2020-11-12
  • Daniel Marjamäki

    There is no support for coroutines right now. And I feel it would be great if we would handle them better. I also feel that I do not understand this feature very well.

    adding "co_return" wherever "return" is

    hmm.. can you show some such tweaks? Spontaneously that sounds wrong.

    ignoring co_await symbol entirely and treating whatever it awaits like a normal function that returns whatever the awaitable's await_return function returns.

    that sounds reasonable. however our valueflow etc should not "call" it I guess.

    I don't really know what the process is here, or source forge in general... So I might need some help there if I'm going to contribute to the project...

    Welcome!

    I would suggest that you make some kind of small proof of concept. And then you can open a github pull request in this repo: http://github.com/danmar/cppcheck

    If this will be a large task then if you can take it one step at a time I'd prefer that you split it up. Perhaps we can focus on either co_return or co_await to start with.. or you can implement the support only in some specific part..

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.