what is the difference between function declaration and signature?

前端 未结 5 1632
故里飘歌
故里飘歌 2020-12-13 00:13

In C or C++ what is the difference between function declaration and function signature?

I know something of function declaration but function signature is totally ne

5条回答
  •  天涯浪人
    2020-12-13 00:49

    The standard defines two terms: declaration and definition. A definition is a tentative declaration. However, the C99 and C++03 standards have slightly varying definitions.

    From C++0x draft:

    Appendix C

    8.3.5 Change: In C++, a function declared with an empty parameter list takes no arguments. In C, an empty parameter list means that the number and type of the function arguments are unknown"

    Definitions

    1.3.11 signature

    the name and the parameter-type-list (8.3.5) of a function, as well as the class, concept, concept map, or namespace of which it is a member. If a function or function template is a class member its signature additionally includes the cv-qualifiers (if any) and the ref-qualifier (if any) on the function or function template itself. The signature of a constrained member (9.2) includes its template requirements. The signature of a function template additionally includes its return type, its template parameter list, and its template requirements (if any). The signature of a function template specialization includes the signature of the template of which it is a specialization and its template arguments (whether explicitly specified or deduced). [ Note: Signatures are used as a basis for name mangling and linking.—end note ]

提交回复
热议问题