INF: C4071 Caused by Missing "void" in Function Prototype

ID Number: Q59439

5.00 5.10 6.00 6.00a 6.00ax | 5.00 5.10 6.00 6.00a

MS-DOS | OS/2

Summary:

Function prototypes must have parameter lists. If no arguments are to

be passed to a function, the parameter list must contain the keyword

"void". At warning level three (/W3), leaving the "void" out of such a

prototype parameter list leads to the following warning message in C

versions 5.0 and 6.0 and QuickC Versions 2.0, 2.01, 2.5, and 2.51:

C4071 'name' : no function prototype given

In C Version 5.1, the following additional warning message occurs:

C4103 Function definition used as prototype

Microsoft C/C++ version 7.0 does not issue the above warning.

More Information:

The following code demonstrates the problem:

Sample Code

-----------

/* Compile option needed: none

myfunc is not prototyped correctly

*/

#include <stdio.h>

void myfunc(); /* missing void in parameter list */

void main(void)

{

myfunc(); /* myfunc still not prototyped */

}

void myfunc() /* function definition doesn't need void */

{

printf("Hello\n");

}