Liste des Groupes | Revenir à cl c |
Michael S <already5chosen@yahoo.com> writes:What if, after the free(a), you have ...
[...]Tried to read the old discussion. Didn't understand much.How exactly would that be useful?
But it strengthened my opinion: it's ridiculous. Standard would be way
better with this nonsense removed.
The function below should be guaranteed by standard to return 42.
int foo(void)
{
char* a = malloc(100);
if (!a) return 42;
char* b = a + 42;
free(a);
return b - a;
}
The intent, I think, is to allow for implementations that perform
checking when loading a pointer value. It's possible that there
currently are no such implementations, but even so, how would
reading a free()d pointer value be useful?
I'd say that passing a pointer value to free() means you no longer care
about it.
Les messages affichés proviennent d'usenet.