Ask Your Question
2

Is it permissible for a coroutine's promise_type to not have return_void or return_value, as long as the coroutine body does not conclude abruptly?

asked 2022-06-27 11:00:00 +0000

pufferfish gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-02-09 08:00:00 +0000

david gravatar image

Yes, it is permissible for the promisetype of a coroutine to not have returnvoid or returnvalue, as long as the coroutine body does not conclude abruptly. In this case, the compiler will assume that the coroutine returns void, and it will not generate any code for the return statement. However, it is recommended to always have either returnvoid or returnvalue in the promisetype, as it makes the intent of the coroutine more clear and avoids any confusion or unintended behavior.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-06-27 11:00:00 +0000

Seen: 12 times

Last updated: Feb 09 '23