Re: returning lvalue in C vs C++
- From: Ben C <spamspam@xxxxxxxxx>
- Date: 31 Mar 2006 18:35:37 GMT
On 2006-03-31, Alf P. Steinbach <alfps@xxxxxxxx> wrote:
* Alan Johnson wrote, on 31.03.2006 11:14:
Alf P. Steinbach wrote:
int main(void)
{
struct thing t = {20};
int y = (f() = t).x;
This is invalid in both C and C++.
Why is this invalid in C++?
The expression 'f() = t'.
The C++ 1998 standard, §3.10/5, "The result of calling a function that
does not return a reference is an rvalue."
Ah, this was the part I was missing! You did mention it before, but not
with chapter and verse from the standard.
That's quite clear then really. Although as you say it's in a
non-normative "Note", and it sounds like something that's had a bit of a
history and a few changes-of-mind.
Anyway, thanks for the detailed explanation.
.
- References:
- returning lvalue in C vs C++
- From: Ben C
- Re: returning lvalue in C vs C++
- From: Phlip
- Re: returning lvalue in C vs C++
- From: Ben C
- Re: returning lvalue in C vs C++
- From: Ben C
- Re: returning lvalue in C vs C++
- From: Kai-Uwe Bux
- Re: returning lvalue in C vs C++
- From: Alf P. Steinbach
- Re: returning lvalue in C vs C++
- From: Ben C
- Re: returning lvalue in C vs C++
- From: Alf P. Steinbach
- Re: returning lvalue in C vs C++
- From: Ben C
- Re: returning lvalue in C vs C++
- From: Alf P. Steinbach
- Re: returning lvalue in C vs C++
- From: Alan Johnson
- Re: returning lvalue in C vs C++
- From: Alf P. Steinbach
- returning lvalue in C vs C++
- Prev by Date: Re: Card dealing and random repetition
- Previous by thread: Re: returning lvalue in C vs C++
- Next by thread: Re: returning lvalue in C vs C++
- Index(es):
Relevant Pages
|