commom malloc/free practice breaks standard - author strikes back

Chris Torek chris at mimsy.umd.edu
Tue Oct 17 13:14:33 AEST 1989


>> Is anyone out there brave enough to AGREE with me?

In article <1284 at virtech.UUCP> cpcahil at virtech.UUCP (Conor P. Cahill) writes:
>Brave has nothing to do with it.  You just don't understand the concept of
>malloc() returning a suitably alligned pointer.

I am sure the fellow *does* understand the concept.  He is not saying
that this is (or is not) how things work.  He is simply saying that, in
his reading, the proposed standard does not make sufficient constraints
on the implementation to force the implementation to work.  In his
opinion, it would be possible for an implementation to conform to the
letter of the standard, yet have code like

	p = (struct foo *)malloc(sizeof(struct foo));
	if (p == NULL) ... handle error ...
	... use *p ...
	free((void *)p);

break.
-- 
`They were supposed to be green.'
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list