 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Kim, Seungtai Guest
|
Posted: Sat Apr 09, 2005 8:29 pm Post subject: simple assignment operator |
|
|
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 (AT) yujinrobot (DOT) 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 ]
|
|
| Back to top |
|
 |
Ray Lischner Guest
|
Posted: Sun Apr 10, 2005 12:11 am Post subject: Re: simple assignment operator |
|
|
On Saturday 09 April 2005 04:29 pm, Kim, Seungtai wrote:
| Quote: | 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 ]
|
|
| Back to top |
|
 |
Kim, Seungtai Guest
|
Posted: Mon Apr 11, 2005 3:06 pm Post subject: Re: simple assignment operator |
|
|
"Ray Lischner"
| Quote: | 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 (AT) yujinrobot (DOT) 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 ]
|
|
| Back to top |
|
 |
Alberto Barbati Guest
|
Posted: Mon Apr 11, 2005 6:55 pm Post subject: Re: simple assignment operator |
|
|
Kim, Seungtai wrote:
| Quote: | "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 ]
|
|
| Back to top |
|
 |
Ray Lischner Guest
|
Posted: Mon Apr 11, 2005 11:20 pm Post subject: Re: simple assignment operator |
|
|
On Monday 11 April 2005 11:06 am, Kim, Seungtai wrote:
| Quote: | 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 ]
|
|
| Back to top |
|
 |
Kim, Seungtai Guest
|
Posted: Tue Apr 12, 2005 9:50 am Post subject: Re: simple assignment operator |
|
|
"Ray Lischner" <rl.news (AT) tempest-sw (DOT) com> wrote
| Quote: | 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 (AT) yujinrobot (DOT) 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 ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|