ID Number: Q41374
5.10 6.00 6.00a 6.00ax | 5.00 5.10 6.00 6.00a
MS-DOS | OS/2
Summary:
The code below shows an inconsistency with the way that the Microsoft
C 5.1 compiler deals with pointer checking. The ANSI standard is
unclear about whether an assignment to a void pointer should be
checked to see if it is being assigned a nonpointer variable. The code
below shows that character pointers are checked while void pointers
are not; the code will generate the following warning:
C4017 : '=' different levels of indirection
Microsoft C 6.0 and later generate the following warning for the void
pointer in the sample code as well as the character pointer:
C4047: '=' different levels of indirection
More Information:
Sample Code:
------------
/* Compile options needed: none
*/
int i; /* i could be float, double, char, long, or unsigned */
char *p;
void *v;
void main()
{
p = i; /* This will give a warning message */
v = i; /* This will not give a warning message */
}
Additional reference words: 5.00 5.10 6.00 6.00a 6.00ax