A longer explanation can be found by referring to the C++ standard:
Quote:
4.2 Array-to-pointer conversion [conv.array]
1 An lvalue of type "array of N T" or "array of unknown bound of T" can
be converted to an rvalue of type "pointer to T." The result is a
pointer to the first element of the array.
2 A string literal (_lex.string_) that is not a wide string literal can
be converted to an rvalue of type "pointer to char"; a wide string
literal can be converted to an rvalue of type "pointer to wchar_t".
In either case, the result is a pointer to the first element of the
array. [Note: this conversion is deprecated. See Annex _depr_. ]
For the purpose of ranking in overload resolution (_over.ics.scs_),
|
The equivalency of the two, under some conditions, is due to a conversion, not an identity. You can see this clearly if you write the relevant code and examine the emitted machine code. This is akin to an integer being converted or promoted to a double, without a cast, if you write the code correctly.