Hi All,
I have one question regarding return value cast of malloc.
I learned that we should not cast the return value of malloc because
it is bug hider.
But my question is as mentioned bellow .
Lets say I have not included stdlib.h in my program still I am using
malloc so compiler will throw warring because with out prototype
compiler assumes that function is declared as extern int
malloc() .Suppose I ignore that warning and did not cast the return
value
Now during linking time my code will be linked to exact
implementation of malloc which returns void * . So in this case will
it be a problem?
Regards,
Somenath
I have one question regarding return value cast of malloc.
I learned that we should not cast the return value of malloc because
it is bug hider.
But my question is as mentioned bellow .
Lets say I have not included stdlib.h in my program still I am using
malloc so compiler will throw warring because with out prototype
compiler assumes that function is declared as extern int
malloc() .Suppose I ignore that warning and did not cast the return
value
Now during linking time my code will be linked to exact
implementation of malloc which returns void * . So in this case will
it be a problem?
Regards,
Somenath
Comment