This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: my fussy compiler likes explicit casts
- From: James Theiler <jt at lanl dot gov>
- To: "J.J.Green" <j dot j dot green at sheffield dot ac dot uk>
- Cc: <gsl-discuss at sources dot redhat dot com>
- Date: Thu, 13 Feb 2003 08:50:30 -0700 (MST)
- Subject: Re: my fussy compiler likes explicit casts
On 13 Feb 2003, J.J.Green wrote:
] 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
]
] http://www.eskimo.com/~scs/C-faq/q7.7.html
]
] Cheers
]
] -j
] --
] J. J. Green, Department of Applied Mathematics, Hicks Bd.,
] Hounsfield Rd., University of Sheffield, Sheffield, UK.
] +44 (0114) 222 3742, http://www.vindaloo.uklinux.net/jjg
]
]
]
Thanks for the insight and for the reference, I suspected something
like that might be the case. I'll take it up with Parasoft.
jt
---------------------------------------------
James Theiler jt@lanl.gov
MS-D436, NIS-2, LANL tel: 505/665-5682
Los Alamos, NM 87545 fax: 505/665-4414
----- Space and Remote Sensing Sciences -----