Topic: simple assignment operator


Author: stkim@yujinrobot.com ("Kim, Seungtai")
Date: Sat, 9 Apr 2005 20:29:27 GMT
Raw View
I found that the Standard dose not say about that
how to copy the value of the right operand to the left operand
in the simple assignment operation.
(what the value is to be stored on the left operand after evaluation)

- But, in ISO C 9899:1999, 6.5.1.6.1/p2, exactly defines the behavior.

    In simple assignment (=), the value of the right operand
    is converted to the type of the assignment expression
    and replaces the value stored in the object designated by the left
    operand.

- ISO C++ 14882 5.17 dose not say anything about it(and even anywhere else).

Is it the detect on the Standard
or an the other anywhere defines the behavior?

--
S Kim <stkim@yujinrobot.com>


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: rl.news@tempest-sw.com (Ray Lischner)
Date: Sun, 10 Apr 2005 00:11:11 GMT
Raw View
On Saturday 09 April 2005 04:29 pm, Kim, Seungtai wrote:

> I found that the Standard dose not say about that
> how to copy the value of the right operand to the left operand
> in the simple assignment operation.
> (what the value is to be stored on the left operand after evaluation)
> ...
> - ISO C++ 14882 5.17 dose not say anything about it(and even anywhere
> else).

5.17, paragraph 2:
"In simple assignment (=), the value of the expression replaces that of
the object referred to by the left operand."
--
Ray Lischner, author of C++ in a Nutshell
http://www.tempest-sw.com/cpp

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: Alberto Barbati <AlbertoBarbati@libero.it>
Date: Mon, 11 Apr 2005 12:55:56 CST
Raw View
Kim, Seungtai wrote:
> "Ray Lischner"
>
>>>I found that the Standard dose not say about that
>>>how to copy the value of the right operand to the left operand
>>>in the simple assignment operation.
>>>(what the value is to be stored on the left operand after evaluation)
>>>...
>>>- ISO C++ 14882 5.17 dose not say anything about it(and even anywhere
>>>else).
>>
>>5.17, paragraph 2:
>>"In simple assignment (=), the value of the expression replaces that of
>>the object referred to by the left operand."
>
> So, what is the value of the expression?
>

I'm not sure about what you are trying to say, but I feel that it might
be related with a minor (formal) ambiguity of the term "expression" in
the wording of 5.17/2. It might refer, gramatically, to:

1) the right operand expression
2) the whole assignment expression

Of course, we all know that it's number 1 (the right operand), short of
the conversions covered in 5.17/3. IMHO, this is a very innocent defect,
because the value of the whole expression is defined in term of what is
stored in left operand, so if 5.17/2 referred to number 2 then there
would be a cyclic reference. However, it's funny to notice that the C
standard uses the clearer and unambiguous wording "right operand"
instead ;-)

Alberto

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: stkim@yujinrobot.com ("Kim, Seungtai")
Date: Mon, 11 Apr 2005 15:06:10 GMT
Raw View
"Ray Lischner"
> > I found that the Standard dose not say about that
> > how to copy the value of the right operand to the left operand
> > in the simple assignment operation.
> > (what the value is to be stored on the left operand after evaluation)
> > ...
> > - ISO C++ 14882 5.17 dose not say anything about it(and even anywhere
> > else).
>
> 5.17, paragraph 2:
> "In simple assignment (=), the value of the expression replaces that of
> the object referred to by the left operand."

So, what is the value of the expression?

--
S Kim <stkim@yujinrobot.com>


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: rl.news@tempest-sw.com (Ray Lischner)
Date: Mon, 11 Apr 2005 23:20:12 GMT
Raw View
On Monday 11 April 2005 11:06 am, Kim, Seungtai wrote:

>> 5.17, paragraph 2:
>> "In simple assignment (=), the value of the expression replaces that
>> of the object referred to by the left operand."
>
> So, what is the value of the expression?

I did not quote that part of the section:

"logical-or-expression assignment-operator assignment-expression"

Although the text refers simply to "the expression" instead of "the
assignment-expression", I think the text is clear. The "value of the
expression" is obviously the value of evaluating
"assignment-expression".
--
Ray Lischner, author of C++ in a Nutshell
http://www.tempest-sw.com/cpp

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: stkim@yujinrobot.com ("Kim, Seungtai")
Date: Tue, 12 Apr 2005 09:50:10 GMT
Raw View
"Ray Lischner" <rl.news@tempest-sw.com> wrote in message news:6320914.67QhXkB8tk@tempest-sw.com...
> On Monday 11 April 2005 11:06 am, Kim, Seungtai wrote:
>
> >> 5.17, paragraph 2:
> >> "In simple assignment (=), the value of the expression replaces that
> >> of the object referred to by the left operand."
> >
> > So, what is the value of the expression?
>
> I did not quote that part of the section:
>
> "logical-or-expression assignment-operator assignment-expression"
>
> Although the text refers simply to "the expression" instead of "the
> assignment-expression", I think the text is clear. The "value of the
> expression" is obviously the value of evaluating
> "assignment-expression".

"assignment-expression" is "logical-or-expression assignment-operator assignment-expression".

--
S Kim <stkim@yujinrobot.com>


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]