INF: C4061 Long/Short Mismatch in Argument

ID Number: Q60253

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

MS-DOS | OS/2

Summary:

In Microsoft C versions earlier than version 6.0, the C4061 warning

was generated only if the actual and formal arguments to a function

were a mix of long and int types. Beginning with Microsoft C version

6.0, this warning message will be generated if the types are a mix of

int and char. This is not a fatal error and is generated only to alert

the programmer that there MAY be a problem.

Microsoft C/C++ version 7.0 generates the following warning:

warning C4761: integral size mismatch in argument; conversion supplied

More Information:

The error message is generated for the following sample code at

warning level 1. If the /qc option is used (quick compile), the

warning is not generated at any warning level. Also, in QuickC

versions 2.0, 2.01, 2.5, and 2.51, a warning is never generated for

this code.

Sample Code

-----------

#include <stdio.h>

void foo (char); /* At prototype level argument type is CHAR */

void main(void);

void main (void)

{

foo (200); /* Now passing an INTEGER to a CHAR */

}

void foo (char c) /* Argument correctly declared as CHAR */

{}

Additional reference words: 2.00 2.50 5.10 6.00 6.00a 6.00ax