Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #127290
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: lvalue types |
| Date | 2018-03-02 19:43 -0800 |
| Organization | None to speak of |
| Message-ID | <lninadg6yb.fsf@kst-u.example.com> (permalink) |
| References | (4 earlier) <dbac55d2-bcc8-4ce1-915b-5cfa78257159@googlegroups.com> <lnvaeefeho.fsf@kst-u.example.com> <cb51d7a5-3c49-40f0-ba06-eaf6232c2bc6@googlegroups.com> <lnmuzqf07c.fsf@kst-u.example.com> <75924da9-ff5c-4cb1-a84b-93c93970bd11@googlegroups.com> |
supercat@casperkitty.com writes:
> On Friday, March 2, 2018 at 6:54:30 PM UTC-6, Keith Thompson wrote:
>> 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.
>
> As I've said before, adding a bullet point wouldn't work. The 6.5p7 rules
> describe the situations in which compilers must allow for the possibility
> of lvalues *which have no visible relationship between them*.
The 6.5p7 rules specify the lvalues that can be used to access
an object. It's not just about lvalues that have "no visible
relationship". Given:
int n;
n = 42;
the access is valid because of the first bullet point; the lvalue `n`
has "a type compatible with the effective type of the object".
BTW, do you agree that an lvalue is a kind of expression, and that the
phrase "lvalue expression" has no intended meaning other than "lvalue"
or "expression that is an lvalue"?
> Does the Standard recognize the concept of "expressions" that don't appear
> in the preprocessed source text?
I don't think so. Why would it?
> Following the execution of:
>
> struct bar { int x;};
> struct foo { int q; struct bar y;};
> struct foo *test9(void)
> {
> int x=0;
> struct foo *p = malloc(2*sizeof (struct foo));
> struct bar *p2 = &(p[++x].y);
> return p;
> }
>
> What term would you use for the things whose address was assigned to p2?
> It can't be an "object" of type p2 because at that point in the code no
You mean of type struct bar.
> such object has ever been created. Expressions in source text don't have
> addresses. So what is that thing?
The malloc call "allocates space for an object", so I'd call it
an object. Since that object is not accessed, I suppose it doesn't
have an effective type. If later code were to evaluate *p2, that
would impose an effective type of struct bar on that object, if I
understand 6.5p6 correctly. (I haven't given this a whole lot of
thought, so I could be missing something.)
--
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 | Next — Previous in thread | Next in thread | Find similar
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