3 ms·
This is a pretty well-regarded answer, with motivation for why you should not cast [1]. Of course it's not something everyone agrees to, but at least a lot of
by unwind 6y ago
This is a pretty well-regarded answer, with motivation for why you should not cast [1].
Of course it's not something everyone agrees to, but at least a lot of people seem to.
[1] https://stackoverflow.com/questions/605845/do-i-cast-the-result-of-malloc https://stackoverflow.com/questions/605845/do-i-cast-the-res...
- throwphoton 6y agoInteresting. Not casting a void pointer return value seems like a bit of a shibboleth for the "C is not a subset of C++" community.
- enriquto 6y agoA "better" shibboleth is using "new" and "old" as identifiers. It serves as a good barrier to avoid accidental C++ compilation.