While browsing the Genode source code documentation, I came across a function who's name started with an asterisk (*), specifically,
Hello::Session_component *_create_session(const char *args)
I typically work in C, not C++ so am a little confused by this. Is this a pointer to a function named _create_session(), is the * part of the function name, or something else completely?
You can find the code example here .
The function is named _create_session, and its return type is a pointer to a Hello::Session_component.
This works just as it does in C:
T *func(); // return type is T*
T* func(); // exact same declaration
*
表示返回类型而不是方法名称,在这种情况下它返回Hello::Session_component*
,因此指向Session_component
的指针。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.