Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Function Type

Like all type expressions, this expression produces a value of the type type.

Also known as a 'function pointer.'

Function-typed values are any declared function with a matching return type and parameters.

Assertions

  1. Each parameter's type expression is a value of the type type.
  2. The return type's expression is a value of the type type.

Representation

If its return type and parameters' types are runtime representable, a function-typed value is represented as a pointer-sized type on the target platform. Otherwise, the function-typed value is a compile-time value with no runtime representation; it cannot exist at runtime.

Syntax

function_type = function, left_paren, [ expression, { comma, expression } ], right_paren, colon, expression ;