Re: Keil c51 interprets &Array as Array. Is that normal?

On Apr 10, 9:59 am, "Bill Davy" <B...@xxxxxxxxxxxxxxx> wrote:
If I compile:

void Foo(void)
{ char Array[10]; char *p; p = &Array; }// Silly
{ char Array[10]; char *p; p = Array; } // Better
{ char Array[10]; char *p; p = &Array[0]; }// Some find this clearer


<snip asm>

Is this normal?
MSVC 6 issues a warning (C4047).

For which lines? Oh and does it report anything other than the number
or are we supposed to intuit the associated message ;)?

The first two are actually pointers to arrays of chars but those
devolve to pointer to char in context (A pointer to an array is a
pointer to the first member of that array). The first two are type
mismatches but the practical effect is only the type mismatch in most
situations. The first assignment is preferred by some people for the
clarity of explicitly indicating that you are taking the address of an
array. There are some additional error checking possible if the type
information is retained.

My memory is fuzzy on whether the second form is of the type pointer
to char or pointer to array of char. I think it's the latter.