Mar 15, 2019 at 8:48pm UTC
I'm wondering what this thingy that gets attached onto the end of the function signature is called.
1 2 3 4 5 6
struct S {
void do_thing() const
{ // ^^^^^ this
}
}
1 2 3 4 5 6
struct V {
void do_other_thing() __restrict
{ // ^^^^^^^^^^ or this
}
};
No other language I know of has this thing.
I'm not asking what it does. I know about const correctness. Just what the h*ck is it called, syntax-wise? A function suffix?
Last edited on Mar 15, 2019 at 8:48pm UTC
Mar 16, 2019 at 1:14am UTC
There's also
ref-qualifiers , optionally an
exception specification , and
attribute-specifiers .
void f() const volatile & noexcept(noexcept(blah)) [[whatever]]
On rare occasions, the Hyperlinked C++ Grammar comes in handy:
https://www.nongnu.org/hcb/#ref-qualifier
But cppreference also summarizes the grammar, usually with an explanation of the productions involved:
https://en.cppreference.com/w/cpp/language/function
To maybe save you some effort reading, there is no semantic distinction that I know of between "specifier" and "qualifier". Not speaking definitively here, I just tried to find out what the difference was a while ago and couldn't.
FWIW, If you said "function suffix" I would know exactly what you meant.
Last edited on Mar 16, 2019 at 1:19am UTC
Mar 16, 2019 at 2:12am UTC
Interesting, never heard the terms before. Thanks all.