[Discuss] Casting the return value of malloc bad?

Daniel M. German dmgerman at uvic.ca
Sun Jul 16 14:41:14 PDT 2006


 Adam> Good point, but if the line immediately before the malloc looked like:

 Adam> SomeType * foo = NULL;


 Adam> then wouldn't sizeof (*foo) choke (NULL pointer dereference)?

*foo is a type, not a reference. It is never evaluated.


--
Daniel M. German                  "Compared to the real life, 
                                   even the best on-line "virtual spaces"
    The Economist ->                are cartoons"
http://turingmachine.org/
http://silvernegative.com/
dmg (at) uvic (dot) ca
replace (at) with @ and (dot) with .

 


More information about the Discuss mailing list