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



Tim Wescott wrote:

Yes it is a pointer to an array of 10 chars. No it is not a pointer to char. There _is_ a difference, but the compiler is well aware of it and will seamlessly cast from pointer-to-array-of-N-char to pointer-to-char.


Absolutely not. A C compiler in a relaxed diagnostics mode might allow something like this, since C compilers by default are traditionally very forgiving when it comes to pointer casts. However, such a conversion is illegal from the language point of view. Any half-decent C compiler will normally issue at least a warning about broken assignment.

--
Best regards,
Andrey Tarasevich
.



Relevant Pages

  • Re: Overloading of operator names - opinions sought
    ... possible, but it is more likely that the known cases will be known to the compiler implementer, and hence will be better optimized. ... char and bool are also special integer types. ... would either require some special stropping syntax, context dependence, ... with the realization that I would need multiple casts due to differences in semantics. ...
    (comp.lang.misc)
  • Re: Replacing fgets
    ... Even if u_int8_t is a typedef for unsigned char, ... Didn't your compiler complain here. ... offset is changed ... offset needs to be an int. ...
    (comp.lang.c)
  • Re: howto get rid of pointer arguments differ in signedness
    ... why don't you provide some argument supporting your 'total ... disagreement' with the idea that C-compilers should support ... Since the specification is ten years younger than 'the compiler', ... char and unsigned char are three mutually incomaptible types, ...
    (comp.os.linux.development.apps)
  • Re: Need support for the IBM support
    ... So the only compiler we have is XL eval with the most recent patches. ... provide a freely-accessible bug reporting web page, ... int main(int argc, char *argv) { ... this=2ff224a0 S(const char* char array) ...
    (comp.unix.aix)
  • Re: Comments on my code?
    ... these are extremely old lecture notes. ... int main(int argc, char **argv) ... I would have written the above declaration as: ... This looks OK to me and works correctly, but the compiler produces ...
    (comp.lang.c)