my fussy compiler likes explicit casts

Thu Feb 13 12:19:00 GMT 2003

Hi all

> Someone who understands casting better than I (especially when const's
> are involved) might want to look these over before applying them.
> There may be better/deeper philosophical reasons not to employ
> explicit casts, but they permit the compiler to work for me

I think it is generally thought to be bad practice to 
make explicit casts of void* types, ie, as returned 
from malloc, at least in C programs (C++ may be different)
- the C standard insists that a void* is automatically
  converted to the correct type on assignment   
- explicit casts can mask errors

See, for example the comp.lang.c FAQ


J. J. Green, Department of Applied Mathematics, Hicks Bd.,
Hounsfield Rd.,  University of Sheffield,  Sheffield, UK. 
+44 (0114) 222 3742,         

More information about the Gsl-discuss mailing list