Up: Function Syntax   [Index]


9.1.1 Type Omitted Function Definitions

The function type may be omitted when definiting functions.

sum(integer a, integer b)
{
    a + b;
}

The evaluation type is deduced from the function body. If the function ends in a simple statement, the type of the statement is used. Otherwise, the type is ‘void’.

main(void)
{
    o_(sum(1024, 3072), "\n");

    0;
}

Type omitted function definitions may be troublesome in a number of way. Apart from acquiring a type other than the anticipated one, they can make the program syntax (procedural or non procedural) more difficult to recognize.

All aime functions have a type, and their definitions include one. A type omitted function definition defines no function before the type is set (with the closing brace). Direct recursive calls and other self references are thus not possible.