cpp_weekly icon indicating copy to clipboard operation
cpp_weekly copied to clipboard

For member functions: What effect do const, noexcept, &, && have on the code generated and what do they mean?

Open sjhowe888 opened this issue 1 year ago • 5 comments

Hi

Could you go through the trailing specifiers for member functions : const, noexcept, & and && and explain what they mean and the effect they have on the code generated fpr this function. I know for certain move functions, they have to be noexcept for a move to used. Is this list complete? If not please cover any additional trailing specifiers.

sjhowe888 avatar Mar 06 '24 14:03 sjhowe888

Also add the keyword "override" which can be a trailing specifier.

sjhowe888 avatar Mar 14 '24 19:03 sjhowe888

And also add the keyword "final" which can be a trailing specifier.

sjhowe888 avatar Mar 14 '24 19:03 sjhowe888

Just to say I want this "episodic" but it is UNCLEAR what you have to do to make it episodic. Is it a checkbox to tick or what? I hate difficult-to-use interfaces.

sjhowe888 avatar Mar 14 '24 19:03 sjhowe888

So we have

const, throw, noexcept, override, final, &, &&

is that all of them? And we have covariant return types

sjhowe888 avatar Mar 14 '24 19:03 sjhowe888

Worth noting, const, &, and && apply to the *this object, and it makes more sense when you use the new explicit object parameter syntax. The other keywords you listed apply to the function instead.

LB-- avatar Apr 06 '24 15:04 LB--