# 9 Declarations [dcl.dcl]

## 9.5 Function definitions [dcl.fct.def]

### 9.5.1 In general [dcl.fct.def.general]

Function definitions have the form
Any informal reference to the body of a function should be interpreted as a reference to the non-terminal function-body.
The optional attribute-specifier-seq in a function-definition appertains to the function.
In a function-definition, either void declarator ; or declarator ; shall be a well-formed function declaration as described in [dcl.fct].
A function shall be defined only in namespace or class scope.
The type of a parameter or the return type for a function definition shall not be a (possibly cv-qualified) class type that is incomplete or abstract within the function body unless the function is deleted ([dcl.fct.def.delete]).
[Example 1:
A simple example of a complete function definition is int max(int a, int b, int c) { int m = (a > b) ? a : b; return (m > c) ? m : c; }
Here int is the decl-specifier-seq; max(int a, int b, int c) is the declarator; { /* ... */ } is the function-body.
— end example]
A ctor-initializer is used only in a constructor; see [class.ctor] and [class.init].
[Note 1:
A cv-qualifier-seq affects the type of this in the body of a member function; see [expr.prim.this].
— end note]
[Note 2:
Unused parameters need not be named.
For example,
void print(int a, int) { std::printf("a = %d\n",a); } — end note]
A function-local predefined variable is a variable with static storage duration that is implicitly defined in a function parameter scope.
The function-local predefined variable __func__ is defined as if a definition of the form static const char __func__[] = "function-name"; had been provided, where function-name is an implementation-defined string.
It is unspecified whether such a variable has an address distinct from that of any other object in the program.86
[Example 2: struct S { S() : s(__func__) { } // OK const char* s; }; void f(const char* s = __func__); // error: __func__ is undeclared — end example]
86)86)
Implementations are permitted to provide additional predefined variables with names that are reserved to the implementation ([lex.name]).
If a predefined variable is not odr-used ([basic.def.odr]), its string value need not be present in the program image.
{"ft_lang_label":"__label__en","ft_lang_prob":0.6772413,"math_prob":0.9401551,"size":759,"snap":"2023-14-2023-23","text_gpt3_token_len":177,"char_repetition_ratio":0.14834437,"word_repetition_ratio":0.0,"special_character_ratio":0.24769433,"punctuation_ratio":0.10948905,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9562004,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-06-06T00:09:24Z\",\"WARC-Record-ID\":\"<urn:uuid:3ccef237-1389-4427-97d5-717ad6f73f81>\",\"Content-Length\":\"25016\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:b9c3e145-6116-4b23-97f6-fd0c1a8afabd>\",\"WARC-Concurrent-To\":\"<urn:uuid:ad87f310-4b9d-4fd7-9fe3-0bad5ac49e7b>\",\"WARC-IP-Address\":\"185.199.109.153\",\"WARC-Target-URI\":\"https://timsong-cpp.github.io/cppwp/dcl.fct.def.general\",\"WARC-Payload-Digest\":\"sha1:EEIXEOH4D64OVRDR6GAACUSPKYH2YLWX\",\"WARC-Block-Digest\":\"sha1:EYOELP5B3RKGHR4IWB4TZ3XDG4DHISCY\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-23/CC-MAIN-2023-23_segments_1685224652184.68_warc_CC-MAIN-20230605221713-20230606011713-00763.warc.gz\"}"}