Sujet : Re: So You Think You Can Const?
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 12. Jan 2025, 12:22:36
Autres entêtes
Organisation : None to speak of
Message-ID : <87cygsjmyr.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6 7 8
User-Agent : Gnus/5.13 (Gnus v5.13)
Michael S <
already5chosen@yahoo.com> writes:
[...]
Tried to read the old discussion. Didn't understand much.
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;
}
How exactly would that be useful?
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.
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */