Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: lvalues from the ternary op Date: Wed, 18 Jan 2017 12:45:27 -0800 Organization: None to speak of Lines: 41 Message-ID: References: <8737kned1h.fsf@bsb.me.uk> <8737klapvv.fsf@bsb.me.uk> <877f6alefh.fsf@bsb.me.uk> <37926c90-a12c-4854-8daf-bbbb6fb36dc0@googlegroups.com> <5ff45dfe-0bd4-479b-a017-64da7de9ae0d@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="54f9ac688d108bee0d0cc30ece7b8d44"; logging-data="15234"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18WjgrJ9V/y9vG9QtUbIt0b" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:a85KaMITIwZp8DF560c2jonZqTw= sha1:0bQ0FXgqZMdec5UIu+25/PZPuG4= Xref: csiph.com comp.lang.c:102150 supercat@casperkitty.com writes: > On Wednesday, January 18, 2017 at 11:59:18 AM UTC-6, Keith Thompson wrote: >> BTW, the 1974 and 1975 editions of the C Reference Manual both say: >> >> An object is a manipulatable region of storage; an lvalue is an >> expression referring to an object. An obvious example of an lvalue >> expression is an identifier. > > Did bitfields exist in either of those? Otherwise, it would seem that > lvalues would be expressions that can have their address taken. Bit fields didn't, but `register` did, with a statement that the "&" operator cannot be applied to a register object. I think that saying that an lvalue refers to an object is more than clear enough. `x` is an lvalue, `x+1` is not. Unary "&" requires an lvalue, but not all lvalues can have unary "&" applied to them, just as not all lvalues can be on the LHS of an assignment. The definition describes what an lvalue is rather than what you can do with it. >> I've discussed this at greater length here: >> https://github.com/Keith-S-Thompson/the-flat-trantor-society/blob/master/005-c-standard-quibbles.md#what-is-an-lvalue > > I don't think I'd seen that paper before. It looks nice. I don't think > there word "potential" should be seen a problem in that context, though I > think it might be better to say that an lvalue represents a "view" of a > potential object. A successful malloc(1000) creates a single object, and > while code may create many views of different parts of it, that doesn't > make each view "an object". I'm not at all sure what point you're making here. The word "potentially" was added to make it clear that *ptr is an lvalue even if ptr's value happens (at run time) to be a null pointer, or some other pointer value that cannot validly be dereferenced. -- Keith Thompson (The_Other_Keith) kst-u@mib.org 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"