casts

gwyn at Brl-Vld.ARPA gwyn at Brl-Vld.ARPA
Sat Mar 24 04:41:37 AEST 1984


From:      Doug Gwyn (VLD/VMB) <gwyn at Brl-Vld.ARPA>

Don't worry; your use of casts on malloc()ed pointers is fine.
The warnings would be valid if it were not for the fact that
malloc() is carefully designed to return pointers to storage
that is aligned stringently enough that the (char *) can be
safely cast to (anything *).  "lint" does not know how malloc()
was designed so it warns about coercing (char *) to (anything *)
and back since that is IN GENERAL unsafe.  It happens not to be
a problem in this case, so ignore the warnings.

The C Language Standards Committee was talking about adding
(void *) to the language as a generic pointer type.  Perhaps
that will eventually help...



More information about the Comp.unix.wizards mailing list