chriskohlhoff / asio

Asio C++ Library
http://think-async.com/Asio
4.72k stars 1.19k forks source link

Easy documentation fix; my_sum example in /overview/composition/coro.html gives different results. #1405

Open jimmbelll opened 6 months ago

jimmbelll commented 6 months ago

In /overview/composition/coro.html, the part dealing with coroutines returning values, has the coro<void> c(...) function expecting sum execution steps to yield 0, 0, 10, 25; but for me it yields 0, 10, 25, 25. I've convinced myself that's the right answer (I say nervously). The first eval discards the -1 and runs from my_sum() entry to the co_yield and value is 0. The second eval brings 10 back from co_yield, adds it to value (0 + 10) and yields 10.

Also, the text above the example code reads:

Putting values into a coroutine can be done it two ways: ...

Should read "... can be done in two ways: ..."

I'm running boost 1.83.0-2 under msys2.org with gcc 13.2.0.

corotest.cpp and coro-build.sh: coro-2024-01-05.zip