lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Am 30.03.2013 15:00 schröbte Owen Shepherd:
The type has already been adjusted by the time of the assignment

Exactly. The parameter type is adjusted, so the conversion of array type to pointer type happens outside of the function call, and the pointer rvalue argument is just assigned to the parameter lvalue. It's basically the same as

void test( int i ) {
  i = 2;
}

test( 3 )

3 isn't an lvalue either, but i is.


On 30 Mar 2013 13:38, "Coda Highland" <chighland@gmail.com> wrote:

On Sat, Mar 30, 2013 at 6:04 AM, Philipp Janda <siffiejoe@gmx.net> wrote:
What had me worried for a moment was (emphasis mine)

6.3.2.1 (Lvalues, arrays, and function designators)
§ 3   Except when it is the operand of the sizeof operator or the unary &
operator, or is a string literal used to initialize an array, an
expression
that has type ‘‘array of type’’ is converted to an expression with type
‘‘pointer to type’’ that points to the initial element of the array
object
_and is not an lvalue_. [...]

What made you STOP worrying about this? It still looks completely
relevant... If you can't convert char[] to a char* lvalue, what makes
you able to assign to it?

/s/ Adam