PRB: C4057 or C4133 Occur Unexpectedly (42562)
The information in this article applies to:
- Microsoft Visual C++ for Windows, 16-bit edition 1.0
- Microsoft Visual C++ for Windows, 16-bit edition 1.5
- Microsoft Visual C++, 32-bit Editions 1.0
- Microsoft Visual C++, 32-bit Editions 2.0
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 5.0
- Microsoft Visual C++, 32-bit Editions 6.0
This article was previously published under Q42562 SYMPTOMS
Using the Microsoft C/C++ compiler (CL.EXE) versions 7.0, 8.0, and 8.0c for
MS-DOS, the following warning is generated:
C4057: 'argument': indirection to slightly different base types
Using the Microsoft C/C++ compiler (CL.EXE) versions 8.0 and 9.0 (32-bit
edition), the following warning is generated:
C4133: 'argument' : incompatible types-from 'short *' to 'int *'
Using the Microsoft C/C++ compiler (CL.EXE) version 10.0 and higher (32-bit
edition), the following warning is generated:
C4133: 'function' : incompatible types-from 'short *' to 'int *'
CAUSE
These warnings are expected behavior. According to ANSI standards,
variables of type int* are different from variables of type short*. And,
although the compiler may be able to perform an implicit promotion/demotion
among intergral types (char, short, int, long, etc.), pointers are not of
integral type.
RESOLUTION
To remove these warnings, use an appropriate cast to instruct the compiler
to explicitly convert the value from its current data type to the desired.
Modification Type: | Minor | Last Reviewed: | 7/5/2005 |
---|
Keywords: | kbprb KB42562 |
---|
|