Why NULL is 0

William E. Davidsen Jr davidsen at steinmetz.steinmetz.ge.com
Wed Apr 6 06:53:40 AEST 1988


  Although the size of int and pointers may be the same on SPARC, my
impression from limited testing is that the machine can't access
unalligned data, and that the compiler doesn't catch this. Thus if I do
something dumb like:

	char m[5];
	a = foo(&m[0], &m[1]);
where:
	foo(x,y)
	  int *x, *y;

that at least one of the pointers will not be on a 4 byte boundary, and
therefore will not work as expected by people who use a VAX, 68000,
80x86, etc. This was the reason for my caution about SPARC.

  If this is not the case, please correct me, as my access to a Sun4 was
limited, and other things might have caused the problem.
-- 
	bill davidsen		(wedu at ge-crd.arpa)
  {uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.lang.c mailing list