Path: csiph.com!weretis.net!feeder8.news.weretis.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c++
Subject: Re: lvalue assignment difference between C and C++
Date: Wed, 22 Feb 2023 06:36:35 -0800
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <86o7plbwcs.fsf@linuxsc.com>
References:
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader01.eternal-september.org; posting-host="ac4e296fa9b47119c23b6ef4a9f9b2b8"; logging-data="1626628"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ucP0uYrubMVnCeKMe/WQyluz5Vb8oTrg="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:PPjI2MNgaU7HAykXT/rQ1wsp1Fc= sha1:qPfBk9B6FUpMnuc3aKF76mczz6c=
Xref: csiph.com comp.lang.c++:89204
Andrey Tarasevich writes:
> C language from the very beginning never cared about preserving the
> lvalue-ness of expression results. In C dereference operator (unary
> *`) and its direct derivatives (e.g. `[]` and `->`) are the only
> operators that produce lvalue results. Everything else produces
> rvalues.
The dot operator ('.') propagates lvalueness.
A compound literal expression gives an lvalue result.
(Sorry if this posting seems misplaced. Given the original
context, comp.lang.c++ seemed like the best choice, even
though the remarks above don't involve C++ per se.)