R
Richard Heathfield
Yevgen Muntyan said:
There is no need to cast malloc, even in a macro.
It's ghastly. It doesn't buy you anything useful. It doesn't encapsulate
anything worth encapsulating.
You snipped the piece where I said when I need to.
There is no need to cast malloc, even in a macro.
The same "simple solution" as was offered elsewhere: avoid
situations where you need cast and you will not need cast.
But I still believe that
#define ALLOC_A_THING(Type) ((Type*) malloc (sizeof (Type)))
is not too bad.
It's ghastly. It doesn't buy you anything useful. It doesn't encapsulate
anything worth encapsulating.