> The solution? You have to use type casting all over the
> place in C++. C
> compilers will just do the type conversion for you (void * to
> char *), but
> C++ compilers complain.
Not C compilers that are compliant with the ANSI standard like the
Metrowerks compiler. The ANSI standard became stricter in 1998, and the
CodeWarrior for Palm OS version 7 compiler reflects this. From section
6.3.4 of the C Standard:
"Conversions that involve pointers, other than where permitted by the
constraints of 6.3.16.1, shall be specified by means of an explicit
cast."
Section 6.3.16.1 talks about legal assignment statements being
constrained in the following manner:
"-the left operand has qualified or unqualified arithmetic type and the
right has arithmetic type;
-the left operand has a qualified or unqualified version of a structure
or union type compatible with the type of the right;
-both operands are pointers to qualified or unqualified versions of
compatible types, and the type pointed to by the left has all the
qualifiers of the type pointed to by the right;
-one operand is a pointer to an object or incomplete type and the other
is a pointer to a qualified or unqualified version of void, and the type
pointed to by the left has all the qualifiers of the type pointed to by
the right; or
-the left operand is a pointer and the right is a null pointer
constant."
So, the version 7 compiler requires an explicit cast from void* to char*
in C as well as C++.
-hkmlt
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/