TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
TIOBE - C Coding Standard
Search

SR:  8.6.3#2Checked automatically with code checker

Synopsis:Function return types shall be explicitly given.
Language:C
Severity Level:6
Category:DECLARATIONS


Description:
Strict definition of interfaces protects the user against inconsistently defined interfaces and is good programming practice. Reliance on the default int return is also error prone.

Example:

long a;
int x;
int f(); /* WRONG - old-style declaration */
...
x = f(a);
f(long a) /* WRONG - implicit int return type */
{
...
}

Example:

long a;
int x;
int f(long); /* RIGHT - function prototype dec. */
...
x = f(a);
int f(long a) /* RIGHT - explicit return type */
{
...
}