A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://timsong-cpp.github.io/cppwp/n4140/dcl.fct.def.general below:

[dcl.fct.def.general]

8.4.1 In general [dcl.fct.def.general]

Example: 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 ]

Note: Unused parameters need not be named. For example,

void print(int a, int) {
  std::printf("a = %d\n",a);
}

 — end note ]

In the function-body, a function-local predefined variable denotes a block-scope object of static storage duration that is implicitly defined (see [basic.scope.block]).

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.104

Example:

struct S {
  S() : s(__func__) { }               const char* s;
};
void f(const char* s = __func__);  

 — end example ]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4