Bit Addressable Architectures

Richard A. O'Keefe ok at quintus.UUCP
Fri Apr 15 13:56:47 AEST 1988


In article <23396 at bbn.COM>, emiller at bbn.com (ethan miller) writes:
> In article <877 at cresswell.quintus.UUCP> ok at quintus.UUCP (Richard A. O'Keefe) writes:
> =>In article <8646 at eleazar.Dartmouth.EDU>, major at eleazar.Dartmouth.EDU (Lou Major) writes:
> =>> sizeof (foo) == sizeof (char *)
> =>Wrong.  The answer *is* 16.  This is one of the few cases where
> =>foo and &(foo[0]) are different.  I _tried_ this to make sure I was right.
> =>That's always a good idea.
> Sure is.  What did you try?  _I_ just tried printing foo and &(foo[0]), and
> they are the same.  BTW, I also tried sizeof (foo), and it is 16.

foo and &(foo[0]) as expressions have different types:
	foo	  : array-of-16-chars
	&(foo[0]) : pointer-to-char
sizeof notices this difference.  In almost any other context, there is an
implicit conversion to pointer-to-char form.  In particular, print() is not
going to reveal the difference.  Consider
	short x = 1; int y = 1;
	printf("%d %d\n", x, y);
Printing obscures the difference between x and y, and in just the same way
it obscures the difference between foo and &(foo[0]).



More information about the Comp.lang.c mailing list