Liste des Groupes | Revenir à l c |
David Brown <david.brown@hesbynett.no> writes:
[...]If you want a better signature for "free", then I would suggest "void>
free(void ** p)" - that (to me) more naturally shows that the function
is freeing the pointer, while also greatly reducing the "use after
free" errors in C code by turning them into "dereferencing a null
pointer" errors which are more easily caught by many OS's.
I'm not sure that would work. A void** argument means you need to pass
a pointer to a void* object. If you've assigned the converted result of
malloc() to, say, an int* object, you don't have a void* object. (int*
and void* might not even have the same representation).
Les messages affichés proviennent d'usenet.