Re:Your code should be taken out back, lined up against a wa...
by sanderjd on Tuesday July 27, 2010 @03:28PM
(#1552412)
You are not the poster who said "casting malloc's return is evil", so perhaps you don't agree with that statement, but I don't see how either of the points you make lead to the conclusion that it is "evil". You say that since void* is implicitly cast to all pointer types, you never need to explicitly cast it, but why would that make an explicit cast evil?
Re:Your code should be taken out back, lined up against a wa...
by mfukar on Tuesday July 27, 2010 @04:01PM
(#1552531)
An explicit cast of the result of malloc() can mask an error when you haven't included its proper definition in stdlib.h.
C++, however, does not allow this. So, if for some reason you're calling malloc rather than new in C++, you need to cast.