Out-of-bounds pointers

John Woods john at frog.UUCP
Fri Oct 13 10:39:00 AEST 1989


In article <976 at crdos1.crd.ge.COM>, davidsen at crdos1.crd.ge.COM (Wm E Davidsen Jr) writes:
> |  The "benefit" is that faster, more natural C implementations are
> |  permitted on architectures where this is an issue.
>   Please identify the machines in question and quantify the saving.
>   Prevailing practice means what it says, that before compilers were
> modified to make it illegal such code would work on most machines, such
> as VAX, VAX, VAX, VAX, VAX, etc. I think that fairly represents every single
> machine and user running pre-ANSI C.

Well, I've adjusted those last 2 sentences a teeny bit, but the meaning is
exactly the same.  To review the conclusion of the comp.lang.c.flame
discussion:

main() {
	extern void paint_memory_blue(char *p, int len);
	char *p = malloc(1000);		/* OK. */
	paint_memory_blue(p, 1000);	/* it better accept NULL... */
	free(p);			/* OK */
	if (p == NULL)	/* Right here, a capability machine may fault.
			 * And it is the programmer's fault for writing this.
			 * If you don't know what a capability machine is,
			 * STOP ARGUING WHAT MACHINES WILL OR WON'T DO!!!
			 * In the words of Dennis M. Ritchie,
			 * "This is non-negotiable."
			 */
		;
}

Everybody clear now?
-- 
John Woods, Charles River Data Systems, Framingham MA 508-626-1101
...!decvax!frog!john, john at frog.UUCP, ...!mit-eddie!jfw, jfw at eddie.mit.edu



More information about the Comp.std.c mailing list