ID Number: Q42562
5.10 6.00 6.00a 6.00ax 7.00 | 5.10 6.00 6.00a
MS-DOS | OS/2
Summary:
SYMPTOMS
Microsoft C version 5.1 and Quick C 2.0 produce warnings when a
function expecting a parameter of type int * receives a parameter
of type short *.
The warnings produced by both C 5.1 and QC 2.0 are:
warning C4049: 'argument' : indirection to different types
warning C4024: 'Func' : different types : parameter 2
There are no warnings produced by C version 6.0, 6.0a, or 6.0ax.
Under C/C++ 7.0, the following warning is generated:
C4057: 'argument': indirection to slightly different base types
CAUSE
These warnings are inconsistent because the compiler is not upset
about Func being passed a short as its first parameter, when it has
been prototyped as accepting an integer, but the same is not true
of pointers to those types.
STATUS
These warnings are expected behavior for both C and QuickC.
More Information:
/* Compile options needed: /c
*/
void ShortFunc( short, short * );
void Func( int, int * );
void main( )
{
short sTest;
short *sPoint;
ShortFunc( sTest, sPoint );
Func( sTest, sPoint );
}
The only restriction on the size of the short given by the ANSI
standard is that it not be longer than an integer. Code should be
written with this in mind so that it will be portable. In many
implementations, integers are not to be the same as shorts.
Additional reference words: 5.10 6.00 6.00a 6.00ax 7.00