Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #127286

Re: lvalue types

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: lvalue types
Date 2018-03-02 16:54 -0800
Organization None to speak of
Message-ID <lnmuzqf07c.fsf@kst-u.example.com> (permalink)
References (2 earlier) <b718a3f5-ca92-479f-bc93-d4a5a2e116ce@googlegroups.com> <lnzi3qfju0.fsf@kst-u.example.com> <dbac55d2-bcc8-4ce1-915b-5cfa78257159@googlegroups.com> <lnvaeefeho.fsf@kst-u.example.com> <cb51d7a5-3c49-40f0-ba06-eaf6232c2bc6@googlegroups.com>

Show all headers | View raw


supercat@casperkitty.com writes:
> On Friday, March 2, 2018 at 1:45:52 PM UTC-6, Keith Thompson wrote:
[...]
>> You should refresh your memory on what the word "lvalue" actually means
>> before you try to change the definition. An lvalue is a kind of
>> expression.  Specifically, it's an expression that (potentially)
>> designates an object.  (The word "potentially" was added in C11 to
>> ensure that *ptr is considered an lvalue even if ptr is a null pointer
>> value when the expression is evaluated.)
>
> My point is that 6.5p7 uses the term "lvalue expression" rather than
> "lvalue", and seems to be talking about something other than the final
> type that would be yielded by processing the whole expression.

The phrase "lvalue expression" is redundant; the word "expression" could
(and probably should) have been omitted.  It simply means "an expression
that is an lvalue".  I can think of no other plausible meaning, since
there is exactly zero doubt that an lvalue is a kind of expression.
When it talks about the type of the "lvalue expression", it simply means
the type of the expression (which is an lvalue).  I see no ambiguity,
only a missing bullet point about accessing subobjects.

>> An expression doesn't "yield" an lvalue.  An expression may *be* an
>> lvalue.  And like any expression, it has a unique and well defined type.
>
> An expression like someArray[func()].foo cannot identify any particular
> object of the element type until it is executed and func() is called.  As
> such, its behavior is that of an expression which, when evaluated, yields
> something that can uniquely identify an object.  What terminology would
> you suggest to distinguish between something that encapsulates the identity
> of a particular object, versus an expression that will identify a [possibly
> different] object each time it is executed?
  
I see no need for any such terminology.  The identity of the object
designated by a given lvalue can vary depending when the lvalue is
evaluated.  So what?

N1570 6.5.2.1p1:

    An lvalue is an expression (with an object type other than void)
    that potentially designates an object if an lvalue does not
    designate an object when it is evaluated, the behavior is undefined.

[...]

Again, it makes no sense to say that an expression "yields" an lvalue.
An lvalue may designate an object.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

lvalue types supercat@casperkitty.com - 2018-03-01 16:38 -0800
  Re: lvalue types Steven Petruzzellis <frelwizzen@gmail.com> - 2018-03-01 17:17 -0800
  Re: lvalue types Keith Thompson <kst-u@mib.org> - 2018-03-01 17:37 -0800
    Re: lvalue types Steven Petruzzellis <frelwizzen@gmail.com> - 2018-03-01 22:00 -0800
    Re: lvalue types Steven Petruzzellis <frelwizzen@gmail.com> - 2018-03-01 23:49 -0800
      Re: lvalue types asetofsymbols@gmail.com - 2018-03-05 06:56 -0800
    Re: lvalue types supercat@casperkitty.com - 2018-03-02 00:22 -0800
      Re: lvalue types Steven Petruzzellis <frelwizzen@gmail.com> - 2018-03-02 01:23 -0800
      Re: lvalue types Steven Petruzzellis <frelwizzen@gmail.com> - 2018-03-02 05:04 -0800
        Re: lvalue types Steven Petruzzellis <frelwizzen@gmail.com> - 2018-03-02 06:06 -0800
          Re: lvalue types Steven Petruzzellis <frelwizzen@gmail.com> - 2018-03-02 08:12 -0800
      Re: lvalue types Keith Thompson <kst-u@mib.org> - 2018-03-02 09:50 -0800
        Re: lvalue types supercat@casperkitty.com - 2018-03-02 11:33 -0800
          Re: lvalue types Keith Thompson <kst-u@mib.org> - 2018-03-02 11:45 -0800
            Re: lvalue types supercat@casperkitty.com - 2018-03-02 16:28 -0800
              Re: lvalue types Keith Thompson <kst-u@mib.org> - 2018-03-02 16:54 -0800
                Re: lvalue types supercat@casperkitty.com - 2018-03-02 17:50 -0800
                Re: lvalue types Keith Thompson <kst-u@mib.org> - 2018-03-02 19:43 -0800
                Re: lvalue types Tim Rentsch <txr@alumni.caltech.edu> - 2018-03-02 22:51 -0800
                Re: lvalue types Steven Petruzzellis <frelwizzen@gmail.com> - 2018-03-02 23:07 -0800
                Re: lvalue types Steven Petruzzellis <frelwizzen@gmail.com> - 2018-03-03 01:44 -0800
                Re: lvalue types supercat@casperkitty.com - 2018-03-03 13:01 -0800
          Re: lvalue types Steven Petruzzellis <frelwizzen@gmail.com> - 2018-03-02 22:21 -0800
    Re: lvalue types supercat@casperkitty.com - 2018-03-02 09:24 -0800
    Re: lvalue types Tim Rentsch <txr@alumni.caltech.edu> - 2018-03-03 00:58 -0800
      Re: lvalue types Steven Petruzzellis <frelwizzen@gmail.com> - 2018-03-03 01:13 -0800
      Re: lvalue types Keith Thompson <kst-u@mib.org> - 2018-03-03 13:01 -0800
        Re: lvalue types supercat <flatfinger@casperkitty.com> - 2018-03-03 17:43 -0800
        Re: lvalue types Tim Rentsch <txr@alumni.caltech.edu> - 2018-03-04 02:22 -0800
          Re: lvalue types supercat@casperkitty.com - 2018-03-04 13:03 -0800
          Re: lvalue types Keith Thompson <kst-u@mib.org> - 2018-03-04 13:03 -0800
            Re: lvalue types bartc <bc@freeuk.com> - 2018-03-04 22:32 +0000
            Re: lvalue types supercat@casperkitty.com - 2018-03-05 09:45 -0800
      Re: lvalue types supercat@casperkitty.com - 2018-03-03 14:19 -0800
  Re: lvalue types Steven Petruzzellis <frelwizzen@gmail.com> - 2018-03-01 18:03 -0800

csiph-web