Bit Addressable Architectures
Larry Jones
scjones at sdrc.UUCP
Fri Apr 15 08:05:21 AEST 1988
In article <7684 at brl-smoke.ARPA>, gwyn at brl-smoke.ARPA (Doug Gwyn ) writes:
> In article <8646 at eleazar.Dartmouth.EDU> major at eleazar.Dartmouth.EDU (Lou Major) writes:
> >char foo[]="This is a test.";
> >sizeof (foo) == sizeof (char *)
>
> Since when?
>
> I know that Gould had a bug in their UTX-32 compiler that made it think
> sizeof"......"==sizeof(char *), but they fixed that and in any case
> it's not the same as your example. So what gives?
>
> (I don't think the array name is turned into a pointer just because it's
> surrounded by parentheses.)
If it ain't, the compiler's broke! The sizeof operator can be applied to a
parenthesized type name or to an expression. Since "foo" isn't a type name,
the operand of sizeof is an expression. When an array name appears in an
expression and it's not the operand of & or sizeof (whose operand is the
parenthesized express, remember), it's converted into a pointer to the first
element.
----
Larry Jones UUCP: uunet!sdrc!scjones
SDRC MAIL: 2000 Eastman Dr., Milford, OH 45150
AT&T: (513) 576-2070
"When all else fails, read the directions."
More information about the Comp.lang.c
mailing list