![]() |
![]() |
In ISO C, a pointer to void can be assigned to a pointer of any other type. You do not need to cast the pointer explicitly. | C++ allows void pointers to be assigned only to other
void pointers. If you use C memory functions that return
void pointers (such as malloc(), calloc(),
realloc()), each void pointer must be cast to an appropriate
pointer type before the code is compiled.
|
The C compiler compiles source code that uses memcmp() to compare a constant char array to a volatile char array. | When attempting to compile source code that uses memcmp() to
compare a constant char array to a volatile char array,
the C++ compiler generates an error message (for example, volatile unsigned char cannot be converted to a const void
pointer). You cannot use a constant pointer where a
volatile pointer is expected unless you cast a void
pointer to the appropriate pointer type before compiling the code.
|
|
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.