What I said above is absolutely correct.
While it is true that every definition is a declaration, the reverse is NOT true.
What??? But who said that the reverse is true?
If it were, you wouldn't need the keyword extern. A data declaration is an attribute list that describes the characteristics of the data item (e.g., ID, type, scope, etc.). Use of the word extern or a function prototype are examples of data declarations. A data definition is also the same attribute list, but also results in memory being allocated for the item.
I don't understand why your are dumping all this here and how it is relevant. Nobody said that every declaration is a definition.
Just remember that "definitions" are subset of "declarations". Every definition is a declaration. Not every declaration is a definition.
And again, in contexts when it doesn't matter whether a given declaration is a definition (or not), people will use the term declaration. That is the accepted practice in C and C++ terminology.
Data declarations do NOT allocate memory.
All declarations is C/C++ are split into two kinds:
- The ones that ARE NOT definitions. We call them "mere declarations" or "non-defining declarations".
- The ones that ARE definitions . We call them "definitions", or "defining declarations".
So, your above quoted assertion is incorrect. There are data declarations that do not allocate memory, and there are data declarations that do. The latter are called "definitions".
When I said I've never seen code written like that before, I usually see an array of pointers to functions initialized with the name of the functions, not the actual code itself. However, since that's still going to resolve to an lvalue, I suppose it should work.
That has nothing to do with "resolviong to lvalue". That has everything to do with C++ lambda-expressions and the fact that a capture-less lambda-expression is implicitly convertible to a plain function pointer.