Re: Writing a C Compiler: lvalues

Keith Thompson <kst-u@mib.org>
Wed, 19 May 2010 19:55:58 -0700

          From comp.compilers

Related articles
[7 earlier articles]
Re: Writing a C Compiler: lvalues marc@lithia.nl (Marc van Lieshout) (2010-05-16)
Re: Writing a C Compiler: lvalues esosman@ieee.org (Eric Sosman) (2010-05-17)
Re: Writing a C Compiler: lvalues kst-u@mib.org (Keith Thompson) (2010-05-17)
Re: Writing a C Compiler: lvalues kst-u@mib.org (Keith Thompson) (2010-05-19)
Re: Writing a C Compiler: lvalues bartc@freeuk.com (bart.c) (2010-05-19)
Re: Writing a C Compiler: lvalues lawrence.jones@siemens.com (2010-05-19)
Re: Writing a C Compiler: lvalues kst-u@mib.org (Keith Thompson) (2010-05-19)
Re: Writing a C Compiler: lvalues DrDiettrich1@aol.com (Hans-Peter Diettrich) (2010-05-20)
Re: Writing a C Compiler: lvalues s_dubrovich@yahoo.com (2010-05-22)
Re: Writing a C Compiler: lvalues lawrence.jones@siemens.com (2010-05-24)
| List of all articles for this month |
From: Keith Thompson <kst-u@mib.org>
Newsgroups: comp.lang.c,comp.compilers
Date: Wed, 19 May 2010 19:55:58 -0700
Organization: None to speak of
References: 10-05-036 10-05-095 10-05-103 10-05-113
Keywords: C
Posted-Date: 19 May 2010 23:42:56 EDT

lawrence.jones@siemens.com writes:
> Keith Thompson <kst-u@mib.org> wrote:
>>
>> So in (x + 5), x *isn't* an lvalue, even though it started out as one.
>
> I disagree -- x *is* an lvalue, but it's converted to the value stored in
> the object when the containing expression is evaluated.


A subtle distinction at best. As I wrote upthread, the standard says:


C99 6.3.2.1p2:


        Except when it is the operand of [list of operators deleted],
        an lvalue that does not have array type is converted to the value
        stored in the designated object (and is no longer an lvalue).


So in the above context, ``x'' *was* an lvalue, but "is no longer"
an lvalue.


The wording is a bit odd. When exactly does it stop being an lvalue?
Surely conversions happen during execution, conceptually at least,
(right?) but by that time lvalue-ness is no longer meaningful.


(Note to comp.compilers readers: this is *very* C-specific.)


--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.