C++ Logo

sg15

Advanced search

Re: [isocpp-core] [isocpp-ext] unqualified-ids looked up by the compiler

From: Nicolai Josuttis <nico_at_[hidden]>
Date: Sat, 7 May 2022 09:18:40 +0200
These are the function I list in my C++20 book:

> get_return_object() Defines the object the coroutine returns
> initial_suspend() Initial suspend point (to let the coroutine start lazy)
> yield_value(val) Deal with a value from co_yield
> unhandled_exception() Reaction on an unhandled exception inside the
> coroutine
> return_void() Deal with the end or a co_return that returns nothing
> return_value(val) Deal with a return value from co_return
> final_suspend() Final suspend point (to let the coroutine end lazy)
> await_transform(...) Map values from co_await to awaiters
> operator new(sz) Define the way the coroutine allocates memory
> operator delete(ptr, sz) Define the way the coroutine frees memory
> get_return_object_on_allocation_failure() Defines the reaction if
> memory allocation failed

Best

  Nico


Am 07.05.2022 um 00:55 schrieb Kirk Shoop via Core:
> Should await_transform be on that list?
>
> On Fri, May 6, 2022 at 12:23 PM Timur Doumler via Ext
> <ext_at_[hidden]> wrote:
>
> In the context of coroutines, there are some user-defined
> functions that will be looked up and called by the compiler in
> certain circumstances. For the promise type, I am currently
> counting the following eight:
>
> get_return_object
> get_return_object_on_allocation_failure
> initial_suspend
> final_suspend
> unhandled_exception
> return_void
> return_value
> yield_value
>
> These need special treatment by dev tools (IDEs, static analysers)
> to not be marked as “unused functions” because even if the dev
> tool sees that the user code never calls them, the compiler still
> might.
>
> Are there any other unqualified-ids apart from the eight above in
> the C++ standard (in the context of coroutines or otherwise) that
> need this special treatment?
>
> Cheers,
> Timur
> _______________________________________________
> Ext mailing list
> Ext_at_[hidden]
> Subscription: https://lists.isocpp.org/mailman/listinfo.cgi/ext
> Link to this post: http://lists.isocpp.org/ext/2022/05/19266.php
>
>
> _______________________________________________
> Core mailing list
> Core_at_[hidden]
> Subscription: https://lists.isocpp.org/mailman/listinfo.cgi/core
> Link to this post: http://lists.isocpp.org/core/2022/05/12494.php

-- 
--- 
Nicolai M. Josuttis
www.josuttis.de
+49 (0)531 / 129 88 86
+49 (0)700 / JOSUTTIS
Books:
 C++: http://cppstd20.com, http://cppstd17.com, http://cppmove.com,
      http://cppstdlib.com, http://tmplbook.com

Received on 2022-05-07 07:18:43