Topic: Some questions about ++ operator


Author: euloanty@live.com
Date: Fri, 20 Dec 2013 20:37:34 -0800 (PST)
Raw View
------=_Part_363_3933231.1387600654494
Content-Type: text/plain; charset=ISO-8859-1

1.about ++s:
int s(0);
++++s;
++s=10;
Are they undefined behaviors?
But if s is a "bigint" not a "int", they are well defined.

2.about s++:
Can we understand s++ as:
{
T temp(s);
++s;
return temp;
}

As I have found a question:
#include<stack>
#include<vector>
int main()
{
 std::stack<int,std::vector<int>> stack;
 stack.emplace(3);
 for(int i(0);i!=10000;++i)
  stack.emplace(stack.top()++);                            //UB??
 return 0;
}

My understand on:
  stack.emplace(stack.top()++);

is

{
  auto temp(stack.top());
  ++stack.top();
  stack.emplace(temp);
}
..
For I have tried on G++,CLANG++,VC++, They all work as I think.
Am I right?

If stack is a std::stack<bigint,std::vector<bigint>> stack; not a
std::stack<int,std::vector<int>>; I'm sure that it works as I think.

int main()
{
 std::stack<bigint,std::vector<bigint>> stack;
 stack.emplace(3);
 for(int i(0);i!=10000;++i)
  stack.emplace(stack.top()++);                            //I am sure that
it's not a UB.
 return 0;
}

If they are UBs, should we expressed them correctly?

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_363_3933231.1387600654494
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>1.about ++s:</div><div>int s(0);</div><div>++++s;</di=
v><div>++s=3D10;</div><div>Are&nbsp;they undefined behaviors?</div><div>But=
 if s is a "bigint" not a "int", they are well defined.</div><div><br></div=
><div>2.about s++:</div><div>Can we understand s++ as:</div><div>{</div><di=
v>T temp(s);</div><div>++s;</div><div>return temp;</div><div>}</div><div><b=
r></div><div>As&nbsp;I have&nbsp;found a question:</div><div>#include&lt;st=
ack&gt;<br>#include&lt;vector&gt;</div><div>int main()<br>{<br>&nbsp;std::s=
tack&lt;int,std::vector&lt;int&gt;&gt; stack;<br>&nbsp;stack.emplace(3);<br=
>&nbsp;for(int i(0);i!=3D10000;++i)<br>&nbsp;&nbsp;stack.emplace(stack.top(=
)++);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp; //UB??<br>&nbsp;return 0;<br>}</div><div><br></div><div>M=
y understand on:</div><div>&nbsp;&nbsp;stack.emplace(stack.top()++);<br></d=
iv><div><br></div><div>is </div><div><br></div><div>{</div><div>&nbsp;&nbsp=
;auto temp(stack.top());</div><div>&nbsp;&nbsp;++stack.top();</div><div><di=
v>&nbsp;&nbsp;stack.emplace(temp);<br></div></div><div>}</div><div>.</div><=
div>For I have tried on G++,CLANG++,VC++, They all work as I think.</div><d=
iv>Am I right?</div><div><br></div><div>If stack is a std::stack&lt;bigint,=
std::vector&lt;bigint&gt;&gt; stack; not a std::stack&lt;int,std::vector&lt=
;int&gt;&gt;; I'm sure that it works as I think.</div><div><div><br></div><=
div>int main()<br>{<br>&nbsp;std::stack&lt;bigint,std::vector&lt;bigint&gt;=
&gt; stack;<br>&nbsp;stack.emplace(3);<br>&nbsp;for(int i(0);i!=3D10000;++i=
)<br>&nbsp;&nbsp;stack.emplace(stack.top()++);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //I am sure that=
 it's not a UB.<br>&nbsp;return 0;<br>}</div></div><div><br></div><div>If t=
hey are UBs, should we expressed&nbsp;them correctly?</div></div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_363_3933231.1387600654494--

.


Author: euloanty@live.com
Date: Fri, 20 Dec 2013 20:41:59 -0800 (PST)
Raw View
------=_Part_17_9708826.1387600919044
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Some people tell me that internal types don't work like class-types.

=E5=9C=A8 2013=E5=B9=B412=E6=9C=8821=E6=97=A5=E6=98=9F=E6=9C=9F=E5=85=ADUTC=
+8=E4=B8=8B=E5=8D=8812=E6=97=B637=E5=88=8634=E7=A7=92=EF=BC=8Ceulo...@live.=
com=E5=86=99=E9=81=93=EF=BC=9A
>
> 1.about ++s:
> int s(0);
> ++++s;
> ++s=3D10;
> Are they undefined behaviors?
> But if s is a "bigint" not a "int", they are well defined.
>
> 2.about s++:
> Can we understand s++ as:
> {
> T temp(s);
> ++s;
> return temp;
> }
>
> As I have found a question:
> #include<stack>
> #include<vector>
> int main()
> {
>  std::stack<int,std::vector<int>> stack;
>  stack.emplace(3);
>  for(int i(0);i!=3D10000;++i)
>   stack.emplace(stack.top()++);                            //UB??
>  return 0;
> }
>
> My understand on:
>   stack.emplace(stack.top()++);
>
> is=20
>
> {
>   auto temp(stack.top());
>   ++stack.top();
>   stack.emplace(temp);
> }
> .
> For I have tried on G++,CLANG++,VC++, They all work as I think.
> Am I right?
>
> If stack is a std::stack<bigint,std::vector<bigint>> stack; not a=20
> std::stack<int,std::vector<int>>; I'm sure that it works as I think.
>
> int main()
> {
>  std::stack<bigint,std::vector<bigint>> stack;
>  stack.emplace(3);
>  for(int i(0);i!=3D10000;++i)
>   stack.emplace(stack.top()++);                            //I am sure=20
> that it's not a UB.
>  return 0;
> }
>
> If they are UBs, should we expressed them correctly?
>

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

------=_Part_17_9708826.1387600919044
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Some people tell me that internal types don't work&nbsp;li=
ke class-types.<br><br>=E5=9C=A8 2013=E5=B9=B412=E6=9C=8821=E6=97=A5=E6=98=
=9F=E6=9C=9F=E5=85=ADUTC+8=E4=B8=8B=E5=8D=8812=E6=97=B637=E5=88=8634=E7=A7=
=92=EF=BC=8Ceulo...@live.com=E5=86=99=E9=81=93=EF=BC=9A<blockquote class=3D=
"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border=
-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style:=
 solid;"><div dir=3D"ltr"><div>1.about ++s:</div><div>int s(0);</div><div>+=
+++s;</div><div>++s=3D10;</div><div>Are&nbsp;they undefined behaviors?</div=
><div>But if s is a "bigint" not a "int", they are well defined.</div><div>=
<br></div><div>2.about s++:</div><div>Can we understand s++ as:</div><div>{=
</div><div>T temp(s);</div><div>++s;</div><div>return temp;</div><div>}</di=
v><div><br></div><div>As&nbsp;I have&nbsp;found a question:</div><div>#incl=
ude&lt;stack&gt;<br>#include&lt;vector&gt;</div><div>int main()<br>{<br>&nb=
sp;std::stack&lt;int,std::vector&lt;<wbr>int&gt;&gt; stack;<br>&nbsp;stack.=
emplace(3);<br>&nbsp;for(int i(0);i!=3D10000;++i)<br>&nbsp;&nbsp;stack.empl=
ace(stack.top()++)<wbr>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //UB??<br>&nbsp;return 0;<br>}</div><d=
iv><br></div><div>My understand on:</div><div>&nbsp;&nbsp;stack.emplace(sta=
ck.top()++)<wbr>;<br></div><div><br></div><div>is </div><div><br></div><div=
>{</div><div>&nbsp;&nbsp;auto temp(stack.top());</div><div>&nbsp;&nbsp;++st=
ack.top();</div><div><div>&nbsp;&nbsp;stack.emplace(temp);<br></div></div><=
div>}</div><div>.</div><div>For I have tried on G++,CLANG++,VC++, They all =
work as I think.</div><div>Am I right?</div><div><br></div><div>If stack is=
 a std::stack&lt;bigint,std::vector&lt;<wbr>bigint&gt;&gt; stack; not a std=
::stack&lt;int,std::vector&lt;<wbr>int&gt;&gt;; I'm sure that it works as I=
 think.</div><div><div><br></div><div>int main()<br>{<br>&nbsp;std::stack&l=
t;bigint,std::<wbr>vector&lt;bigint&gt;&gt; stack;<br>&nbsp;stack.emplace(3=
);<br>&nbsp;for(int i(0);i!=3D10000;++i)<br>&nbsp;&nbsp;stack.emplace(stack=
..top()++)<wbr>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp; //I am sure that it's not a UB.<br>&nbsp;return=
 0;<br>}</div></div><div><br></div><div>If they are UBs, should we expresse=
d&nbsp;them correctly?</div></div></blockquote></div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_17_9708826.1387600919044--

.


Author: "Billy O'Neal" <billy.oneal@gmail.com>
Date: Fri, 20 Dec 2013 22:23:33 -0800
Raw View
--e89a8ff1ce0285ca2d04ee05711e
Content-Type: text/plain; charset=ISO-8859-1

1. ++++s is ill formed; ++ can only be applied to an lvalue. ++s = 10 is
undefined behavior because the write to s as part of ++ and the write
assigning s to 10 are unsequenced. For instance, a compiler could add 1 to
s and store the result in a register, then assign 10 to s, then assign the
register contents of the register to s. (Result: s = s + 1) The compiler
could also add 1 to s, store the result back to s, and then assign 10 to s.
(Result: s == 10). (Of course, undefined behavior means more than this, but
these are the most likely actual behaviors by an actual compiler)
2. No. That is semantically what occurs, but a compiler is under no
obligation to actually do the operations in that order. (If it were done as
separate statements, the compiler would have no freedom to reorder here)
3. stack.emplace(stack.top()++); is well defined because the evaluation of
function arguments is sequenced before the execution of a function.
Therefore, the ++ must occur before the emplacement (at least as far as
observable behavior of the program is concerned). See N3691 1.9
[intro.execution]/15:


When calling a function (whether or not the function is inline), every
value computation and side effect
associated with any argument expression, or with the postfix expression
designating the called function, is
sequenced before execution of every expression or statement in the body of
the called function.



Billy O'Neal
https://github.com/BillyONeal/ <https://bitbucket.org/BillyONeal/>
http://stackoverflow.com/users/82320/billy-oneal
Malware Response Instructor - BleepingComputer.com


On Fri, Dec 20, 2013 at 8:37 PM, <euloanty@live.com> wrote:

> 1.about ++s:
> int s(0);
> ++++s;
> ++s=10;
> Are they undefined behaviors?
> But if s is a "bigint" not a "int", they are well defined.
>
> 2.about s++:
> Can we understand s++ as:
> {
> T temp(s);
> ++s;
> return temp;
> }
>
> As I have found a question:
> #include<stack>
> #include<vector>
> int main()
> {
>  std::stack<int,std::vector<int>> stack;
>  stack.emplace(3);
>  for(int i(0);i!=10000;++i)
>   stack.emplace(stack.top()++);                            //UB??
>  return 0;
> }
>
> My understand on:
>   stack.emplace(stack.top()++);
>
> is
>
> {
>   auto temp(stack.top());
>   ++stack.top();
>   stack.emplace(temp);
> }
> .
> For I have tried on G++,CLANG++,VC++, They all work as I think.
> Am I right?
>
> If stack is a std::stack<bigint,std::vector<bigint>> stack; not a
> std::stack<int,std::vector<int>>; I'm sure that it works as I think.
>
> int main()
> {
>  std::stack<bigint,std::vector<bigint>> stack;
>  stack.emplace(3);
>  for(int i(0);i!=10000;++i)
>   stack.emplace(stack.top()++);                            //I am sure
> that it's not a UB.
>  return 0;
> }
>
> If they are UBs, should we expressed them correctly?
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--e89a8ff1ce0285ca2d04ee05711e
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">1. ++++s is ill formed; ++ can only be applied to an lvalu=
e. ++s =3D 10 is undefined behavior because the write to s as part of ++ an=
d the write assigning s to 10 are unsequenced. For instance, a compiler cou=
ld add 1 to s and store the result in a register, then assign 10 to s, then=
 assign the register contents of the register to s. (Result: s =3D s + 1) T=
he compiler could also add 1 to s, store the result back to s, and then ass=
ign 10 to s. (Result: s =3D=3D 10). (Of course, undefined behavior means mo=
re than this, but these are the most likely actual behaviors by an actual c=
ompiler)<div>

2. No. That is semantically what occurs, but a compiler is under no obligat=
ion to actually do the operations in that order. (If it were done as separa=
te statements, the compiler would have no freedom to reorder here)</div>

<div>3.=A0<span style=3D"font-size:13px;font-family:arial,sans-serif">stack=
..emplace(stack.top()++)</span><span style=3D"font-size:13px;font-family:ari=
al,sans-serif">; is well defined because the evaluation of function argumen=
ts is sequenced before the execution of a function. Therefore, the ++ must =
occur before the emplacement (at least as far as observable behavior of the=
 program is concerned). See N3691 1.9 [intro.execution]/15:</span></div>

<blockquote style=3D"margin:0 0 0 40px;border:none;padding:0px"><div><span =
style=3D"font-size:13px;font-family:arial,sans-serif"><br></span></div><div=
><span style=3D"font-size:13px;font-family:arial,sans-serif"><div>When call=
ing a function (whether or not the function is inline), every value computa=
tion and side effect</div>

</span></div><div><span style=3D"font-size:13px;font-family:arial,sans-seri=
f"><div>associated with any argument expression, or with the postfix expres=
sion designating the called function, is</div></span></div><div><span style=
=3D"font-size:13px;font-family:arial,sans-serif"><div>

sequenced before execution of every expression or statement in the body of =
the called function.</div></span></div></blockquote><div><span style=3D"fon=
t-size:13px;font-family:arial,sans-serif"><div><br></div></span></div></div=
>

<div class=3D"gmail_extra"><br clear=3D"all"><div><div dir=3D"ltr"><div>Bil=
ly O&#39;Neal</div><div><a href=3D"https://bitbucket.org/BillyONeal/" targe=
t=3D"_blank">https://github.com/BillyONeal/</a></div><div><a href=3D"http:/=
/stackoverflow.com/users/82320/billy-oneal" target=3D"_blank">http://stacko=
verflow.com/users/82320/billy-oneal</a></div>

<div>Malware Response Instructor - BleepingComputer.com</div></div></div>
<br><br><div class=3D"gmail_quote">On Fri, Dec 20, 2013 at 8:37 PM,  <span =
dir=3D"ltr">&lt;<a href=3D"mailto:euloanty@live.com" target=3D"_blank">eulo=
anty@live.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir=3D"ltr"><div>1.about ++s:</div><div>int s(0);</div><div>++++s;</di=
v><div>++s=3D10;</div><div>Are=A0they undefined behaviors?</div><div>But if=
 s is a &quot;bigint&quot; not a &quot;int&quot;, they are well defined.</d=
iv>

<div><br></div><div>2.about s++:</div><div>Can we understand s++ as:</div><=
div>{</div><div>T temp(s);</div><div>++s;</div><div>return temp;</div><div>=
}</div><div><br></div><div>As=A0I have=A0found a question:</div><div>#inclu=
de&lt;stack&gt;<br>

#include&lt;vector&gt;</div><div>int main()<br>{<br>=A0std::stack&lt;int,st=
d::vector&lt;int&gt;&gt; stack;<br>=A0stack.emplace(3);<br>=A0for(int i(0);=
i!=3D10000;++i)<br>=A0=A0stack.emplace(stack.top()++);=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 //UB??<br>

=A0return 0;<br>}</div><div><br></div><div>My understand on:</div><div>=A0=
=A0stack.emplace(stack.top()++);<br></div><div><br></div><div>is </div><div=
><br></div><div>{</div><div>=A0=A0auto temp(stack.top());</div><div>=A0=A0+=
+stack.top();</div>

<div><div>=A0=A0stack.emplace(temp);<br></div></div><div>}</div><div>.</div=
><div>For I have tried on G++,CLANG++,VC++, They all work as I think.</div>=
<div>Am I right?</div><div><br></div><div>If stack is a std::stack&lt;bigin=
t,std::vector&lt;bigint&gt;&gt; stack; not a std::stack&lt;int,std::vector&=
lt;int&gt;&gt;; I&#39;m sure that it works as I think.</div>

<div><div><br></div><div>int main()<br>{<br>=A0std::stack&lt;bigint,std::ve=
ctor&lt;bigint&gt;&gt; stack;<br>=A0stack.emplace(3);<br>=A0for(int i(0);i!=
=3D10000;++i)<br>=A0=A0stack.emplace(stack.top()++);=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 //I am sure th=
at it&#39;s not a UB.<br>

=A0return 0;<br>}</div></div><div><br></div><div>If they are UBs, should we=
 expressed=A0them correctly?</div></div><span class=3D"HOEnZb"><font color=
=3D"#888888">

<p></p>

-- <br>
=A0<br>
--- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org" target=3D=
"_blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</font></span></blockquote></div><br></div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--e89a8ff1ce0285ca2d04ee05711e--

.


Author: "Billy O'Neal" <billy.oneal@gmail.com>
Date: Fri, 20 Dec 2013 22:25:21 -0800
Raw View
--047d7b414f40f0386204ee057743
Content-Type: text/plain; charset=ISO-8859-1

Ah, scratch what I said in #1 -- it is ill-formed in C but well-formed in
C++. It still causes undefined behavior in this case though :)

Billy O'Neal
https://github.com/BillyONeal/ <https://bitbucket.org/BillyONeal/>
http://stackoverflow.com/users/82320/billy-oneal
Malware Response Instructor - BleepingComputer.com


On Fri, Dec 20, 2013 at 10:23 PM, Billy O'Neal <billy.oneal@gmail.com>wrote:

> 1. ++++s is ill formed; ++ can only be applied to an lvalue. ++s = 10 is
> undefined behavior because the write to s as part of ++ and the write
> assigning s to 10 are unsequenced. For instance, a compiler could add 1 to
> s and store the result in a register, then assign 10 to s, then assign the
> register contents of the register to s. (Result: s = s + 1) The compiler
> could also add 1 to s, store the result back to s, and then assign 10 to s.
> (Result: s == 10). (Of course, undefined behavior means more than this, but
> these are the most likely actual behaviors by an actual compiler)
> 2. No. That is semantically what occurs, but a compiler is under no
> obligation to actually do the operations in that order. (If it were done as
> separate statements, the compiler would have no freedom to reorder here)
> 3. stack.emplace(stack.top()++); is well defined because the evaluation
> of function arguments is sequenced before the execution of a function.
> Therefore, the ++ must occur before the emplacement (at least as far as
> observable behavior of the program is concerned). See N3691 1.9
> [intro.execution]/15:
>
>
> When calling a function (whether or not the function is inline), every
> value computation and side effect
> associated with any argument expression, or with the postfix expression
> designating the called function, is
> sequenced before execution of every expression or statement in the body of
> the called function.
>
>
>
> Billy O'Neal
> https://github.com/BillyONeal/ <https://bitbucket.org/BillyONeal/>
> http://stackoverflow.com/users/82320/billy-oneal
> Malware Response Instructor - BleepingComputer.com
>
>
> On Fri, Dec 20, 2013 at 8:37 PM, <euloanty@live.com> wrote:
>
>> 1.about ++s:
>> int s(0);
>> ++++s;
>> ++s=10;
>> Are they undefined behaviors?
>> But if s is a "bigint" not a "int", they are well defined.
>>
>> 2.about s++:
>> Can we understand s++ as:
>> {
>> T temp(s);
>> ++s;
>> return temp;
>> }
>>
>> As I have found a question:
>> #include<stack>
>> #include<vector>
>> int main()
>> {
>>  std::stack<int,std::vector<int>> stack;
>>  stack.emplace(3);
>>  for(int i(0);i!=10000;++i)
>>   stack.emplace(stack.top()++);                            //UB??
>>  return 0;
>> }
>>
>> My understand on:
>>   stack.emplace(stack.top()++);
>>
>> is
>>
>> {
>>   auto temp(stack.top());
>>   ++stack.top();
>>   stack.emplace(temp);
>> }
>> .
>> For I have tried on G++,CLANG++,VC++, They all work as I think.
>> Am I right?
>>
>> If stack is a std::stack<bigint,std::vector<bigint>> stack; not a
>> std::stack<int,std::vector<int>>; I'm sure that it works as I think.
>>
>> int main()
>> {
>>  std::stack<bigint,std::vector<bigint>> stack;
>>  stack.emplace(3);
>>  for(int i(0);i!=10000;++i)
>>   stack.emplace(stack.top()++);                            //I am sure
>> that it's not a UB.
>>  return 0;
>> }
>>
>> If they are UBs, should we expressed them correctly?
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to std-proposals+unsubscribe@isocpp.org.
>> To post to this group, send email to std-proposals@isocpp.org.
>> Visit this group at
>> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>>
>
>

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--047d7b414f40f0386204ee057743
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Ah, scratch what I said in #1 -- it is ill-formed in C but=
 well-formed in C++. It still causes undefined behavior in this case though=
 :)</div><div class=3D"gmail_extra"><br clear=3D"all"><div><div dir=3D"ltr"=
><div>

Billy O&#39;Neal</div><div><a href=3D"https://bitbucket.org/BillyONeal/" ta=
rget=3D"_blank">https://github.com/BillyONeal/</a></div><div><a href=3D"htt=
p://stackoverflow.com/users/82320/billy-oneal" target=3D"_blank">http://sta=
ckoverflow.com/users/82320/billy-oneal</a></div>

<div>Malware Response Instructor - BleepingComputer.com</div></div></div>
<br><br><div class=3D"gmail_quote">On Fri, Dec 20, 2013 at 10:23 PM, Billy =
O&#39;Neal <span dir=3D"ltr">&lt;<a href=3D"mailto:billy.oneal@gmail.com" t=
arget=3D"_blank">billy.oneal@gmail.com</a>&gt;</span> wrote:<br><blockquote=
 class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc soli=
d;padding-left:1ex">

<div dir=3D"ltr">1. ++++s is ill formed; ++ can only be applied to an lvalu=
e. ++s =3D 10 is undefined behavior because the write to s as part of ++ an=
d the write assigning s to 10 are unsequenced. For instance, a compiler cou=
ld add 1 to s and store the result in a register, then assign 10 to s, then=
 assign the register contents of the register to s. (Result: s =3D s + 1) T=
he compiler could also add 1 to s, store the result back to s, and then ass=
ign 10 to s. (Result: s =3D=3D 10). (Of course, undefined behavior means mo=
re than this, but these are the most likely actual behaviors by an actual c=
ompiler)<div>


2. No. That is semantically what occurs, but a compiler is under no obligat=
ion to actually do the operations in that order. (If it were done as separa=
te statements, the compiler would have no freedom to reorder here)</div>


<div>3.=A0<span style=3D"font-size:13px;font-family:arial,sans-serif">stack=
..emplace(stack.top()++)</span><span style=3D"font-size:13px;font-family:ari=
al,sans-serif">; is well defined because the evaluation of function argumen=
ts is sequenced before the execution of a function. Therefore, the ++ must =
occur before the emplacement (at least as far as observable behavior of the=
 program is concerned). See N3691 1.9 [intro.execution]/15:</span></div>


<blockquote style=3D"margin:0 0 0 40px;border:none;padding:0px"><div><span =
style=3D"font-size:13px;font-family:arial,sans-serif"><br></span></div><div=
><span style=3D"font-size:13px;font-family:arial,sans-serif"><div>When call=
ing a function (whether or not the function is inline), every value computa=
tion and side effect</div>


</span></div><div><span style=3D"font-size:13px;font-family:arial,sans-seri=
f"><div>associated with any argument expression, or with the postfix expres=
sion designating the called function, is</div></span></div><div><span style=
=3D"font-size:13px;font-family:arial,sans-serif"><div>


sequenced before execution of every expression or statement in the body of =
the called function.</div></span></div></blockquote><span class=3D"HOEnZb">=
<font color=3D"#888888"><div><span style=3D"font-size:13px;font-family:aria=
l,sans-serif"><div>

<br></div></span></div></font></span></div><span class=3D"HOEnZb"><font col=
or=3D"#888888">
</font></span><div class=3D"gmail_extra"><span class=3D"HOEnZb"><font color=
=3D"#888888"><br clear=3D"all"><div><div dir=3D"ltr"><div>Billy O&#39;Neal<=
/div><div><a href=3D"https://bitbucket.org/BillyONeal/" target=3D"_blank">h=
ttps://github.com/BillyONeal/</a></div>

<div><a href=3D"http://stackoverflow.com/users/82320/billy-oneal" target=3D=
"_blank">http://stackoverflow.com/users/82320/billy-oneal</a></div>
<div>Malware Response Instructor - BleepingComputer.com</div></div></div></=
font></span><div><div class=3D"h5">
<br><br><div class=3D"gmail_quote">On Fri, Dec 20, 2013 at 8:37 PM,  <span =
dir=3D"ltr">&lt;<a href=3D"mailto:euloanty@live.com" target=3D"_blank">eulo=
anty@live.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div dir=3D"ltr"><div>1.about ++s:</div><div>int s(0);</div><div>++++s;</di=
v><div>++s=3D10;</div><div>Are=A0they undefined behaviors?</div><div>But if=
 s is a &quot;bigint&quot; not a &quot;int&quot;, they are well defined.</d=
iv>


<div><br></div><div>2.about s++:</div><div>Can we understand s++ as:</div><=
div>{</div><div>T temp(s);</div><div>++s;</div><div>return temp;</div><div>=
}</div><div><br></div><div>As=A0I have=A0found a question:</div><div>#inclu=
de&lt;stack&gt;<br>


#include&lt;vector&gt;</div><div>int main()<br>{<br>=A0std::stack&lt;int,st=
d::vector&lt;int&gt;&gt; stack;<br>=A0stack.emplace(3);<br>=A0for(int i(0);=
i!=3D10000;++i)<br>=A0=A0stack.emplace(stack.top()++);=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 //UB??<br>


=A0return 0;<br>}</div><div><br></div><div>My understand on:</div><div>=A0=
=A0stack.emplace(stack.top()++);<br></div><div><br></div><div>is </div><div=
><br></div><div>{</div><div>=A0=A0auto temp(stack.top());</div><div>=A0=A0+=
+stack.top();</div>


<div><div>=A0=A0stack.emplace(temp);<br></div></div><div>}</div><div>.</div=
><div>For I have tried on G++,CLANG++,VC++, They all work as I think.</div>=
<div>Am I right?</div><div><br></div><div>If stack is a std::stack&lt;bigin=
t,std::vector&lt;bigint&gt;&gt; stack; not a std::stack&lt;int,std::vector&=
lt;int&gt;&gt;; I&#39;m sure that it works as I think.</div>


<div><div><br></div><div>int main()<br>{<br>=A0std::stack&lt;bigint,std::ve=
ctor&lt;bigint&gt;&gt; stack;<br>=A0stack.emplace(3);<br>=A0for(int i(0);i!=
=3D10000;++i)<br>=A0=A0stack.emplace(stack.top()++);=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 //I am sure th=
at it&#39;s not a UB.<br>


=A0return 0;<br>}</div></div><div><br></div><div>If they are UBs, should we=
 expressed=A0them correctly?</div></div><span><font color=3D"#888888">

<p></p>

-- <br>
=A0<br>
--- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org" target=3D=
"_blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</font></span></blockquote></div><br></div></div></div>
</blockquote></div><br></div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--047d7b414f40f0386204ee057743--

.


Author: wsdwsd <euloanty@live.com>
Date: Sat, 21 Dec 2013 07:08:37 +0000
Raw View
--_2D282236-F5F0-4EA0-9A6B-5208B241EDB7_
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=windows-1252

1. ++++s is ill formed.

I think it=92s no. In C++ Compiler, ++s return the reference of the s, so +=
+++s can be compiled by C++ compilers but not in C Compilers.

=20





Sent from Windows Mail





From: Billy O'Neal
Sent: Saturday, December 21, 2013 2:26 PM
To: std-proposals@isocpp.org





Ah, scratch what I said in #1 -- it is ill-formed in C but well-formed in C=
++. It still causes undefined behavior in this case though :)





Billy O'Neal

https://github.com/BillyONeal/

http://stackoverflow.com/users/82320/billy-oneal

Malware Response Instructor - BleepingComputer.com



On Fri, Dec 20, 2013 at 10:23 PM, Billy O'Neal <billy.oneal@gmail.com> wrot=
e:


1. ++++s is ill formed; ++ can only be applied to an lvalue. ++s =3D 10 is =
undefined behavior because the write to s as part of ++ and the write assig=
ning s to 10 are unsequenced. For instance, a compiler could add 1 to s and=
 store the result in a register, then assign 10 to s, then assign the regis=
ter contents of the register to s. (Result: s =3D s + 1) The compiler could=
 also add 1 to s, store the result back to s, and then assign 10 to s. (Res=
ult: s =3D=3D 10). (Of course, undefined behavior means more than this, but=
 these are the most likely actual behaviors by an actual compiler)
2. No. That is semantically what occurs, but a compiler is under no obligat=
ion to actually do the operations in that order. (If it were done as separa=
te statements, the compiler would have no freedom to reorder here)

3. stack.emplace(stack.top()++); is well defined because the evaluation of =
function arguments is sequenced before the execution of a function. Therefo=
re, the ++ must occur before the emplacement (at least as far as observable=
 behavior of the program is concerned). See N3691 1.9 [intro.execution]/15:






When calling a function (whether or not the function is inline), every valu=
e computation and side effect


associated with any argument expression, or with the postfix expression des=
ignating the called function, is


sequenced before execution of every expression or statement in the body of =
the called function.









Billy O'Neal

https://github.com/BillyONeal/

http://stackoverflow.com/users/82320/billy-oneal

Malware Response Instructor - BleepingComputer.com


=20


On Fri, Dec 20, 2013 at 8:37 PM, <euloanty@live.com> wrote:



1.about ++s:

int s(0);

++++s;

++s=3D10;

Are they undefined behaviors?

But if s is a "bigint" not a "int", they are well defined.




2.about s++:

Can we understand s++ as:

{

T temp(s);

++s;

return temp;

}




As I have found a question:

#include<stack>
#include<vector>

int main()
{
 std::stack<int,std::vector<int>> stack;
 stack.emplace(3);
 for(int i(0);i!=3D10000;++i)
  stack.emplace(stack.top()++);                            //UB??
 return 0;
}




My understand on:

  stack.emplace(stack.top()++);





is=20




{

  auto temp(stack.top());

  ++stack.top();


  stack.emplace(temp);


}

..

For I have tried on G++,CLANG++,VC++, They all work as I think.

Am I right?




If stack is a std::stack<bigint,std::vector<bigint>> stack; not a std::stac=
k<int,std::vector<int>>; I'm sure that it works as I think.





int main()
{
 std::stack<bigint,std::vector<bigint>> stack;
 stack.emplace(3);
 for(int i(0);i!=3D10000;++i)
  stack.emplace(stack.top()++);                            //I am sure that=
 it's not a UB.
 return 0;
}




If they are UBs, should we expressed them correctly?

--=20
=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.



--=20
=20
---=20
You received this message because you are subscribed to a topic in the Goog=
le Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this topic, visit https://groups.google.com/a/isocpp.or=
g/d/topic/std-proposals/RNWtBfjWXQk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to std-pro=
posals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--_2D282236-F5F0-4EA0-9A6B-5208B241EDB7_
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=windows-1252


<html>
<head>
<meta name=3D"generator" content=3D"Windows Mail 17.5.9600.20315">
<style data-externalstyle=3D"true"><!--
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
}
p.MsoNormal, li.MsoNormal, div.MsoNormal {
margin:0in;
margin-bottom:.0001pt;
}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParag=
raphCxSpFirst,=20
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListPar=
agraphCxSpMiddle,=20
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagra=
phCxSpLast {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
line-height:115%;
}
--></style></head>
<body dir=3D"ltr">
<div data-externalstyle=3D"false" dir=3D"ltr" style=3D"font-family: 'Calibr=
i', 'Microsoft YaHei UI', 'Segoe UI', 'Meiryo', 'Microsoft JhengHei UI', 'M=
algun Gothic', 'sans-serif';font-size:12pt;"><div style=3D"color: rgb(0, 0,=
 0);">1. ++++s is ill formed.</div><div style=3D"color: rgb(0, 0, 0);">I th=
ink it=92s no. In C++ Compiler, ++s return the reference of the s, so ++++s=
 can be compiled by&nbsp;C++ compilers but not in C Compilers.</div><div st=
yle=3D"color: rgb(0, 0, 0);">&nbsp;</div><div style=3D"color: rgb(0, 0, 0);=
"><br></div><div style=3D"color: rgb(0, 0, 0);" data-signatureblock=3D"true=
"><div style=3D"color: rgb(0, 0, 0);">Sent from Windows Mail</div><div styl=
e=3D"color: rgb(0, 0, 0);"><br></div></div><div style=3D"padding-top: 5px; =
border-top-color: rgb(229, 229, 229); border-top-width: 1px; border-top-sty=
le: solid;"><div><font face=3D" 'Calibri', 'Microsoft YaHei UI', 'Segoe UI'=
, 'Meiryo', 'Microsoft JhengHei UI', 'Malgun Gothic', 'sans-serif'" style=
=3D'line-height: 15pt; letter-spacing: 0.02em; font-family: "Calibri", "Mic=
rosoft YaHei UI", "Segoe UI", "Meiryo", "Microsoft JhengHei UI", "Malgun Go=
thic", "sans-serif"; font-size: 12pt;'><b>From:</b>&nbsp;<a href=3D"mailto:=
billy.oneal@gmail.com" target=3D"_parent">Billy O'Neal</a><br><b>Sent:</b>&=
nbsp;Saturday, December 21, 2013 2:26 PM<br><b>To:</b>&nbsp;<a href=3D"mail=
to:std-proposals@isocpp.org" target=3D"_parent">std-proposals@isocpp.org</a=
></font></div></div><div><br></div><div dir=3D""><div dir=3D"ltr">Ah, scrat=
ch what I said in #1 -- it is ill-formed in C but well-formed in C++. It st=
ill causes undefined behavior in this case though :)</div><div class=3D"gma=
il_extra"><br clear=3D"all"><div><div dir=3D"ltr"><div>

Billy O'Neal</div><div><a href=3D"https://bitbucket.org/BillyONeal/" target=
=3D"_parent">https://github.com/BillyONeal/</a></div><div><a href=3D"http:/=
/stackoverflow.com/users/82320/billy-oneal" target=3D"_parent">http://stack=
overflow.com/users/82320/billy-oneal</a></div>

<div>Malware Response Instructor - BleepingComputer.com</div></div></div>
<br><br><div class=3D"gmail_quote">On Fri, Dec 20, 2013 at 10:23 PM, Billy =
O'Neal <span dir=3D"ltr">&lt;<a href=3D"mailto:billy.oneal@gmail.com" targe=
t=3D"_parent">billy.oneal@gmail.com</a>&gt;</span> wrote:<br><blockquote cl=
ass=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; =
border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-=
style: solid;">

<div dir=3D"ltr">1. ++++s is ill formed; ++ can only be applied to an lvalu=
e. ++s =3D 10 is undefined behavior because the write to s as part of ++ an=
d the write assigning s to 10 are unsequenced. For instance, a compiler cou=
ld add 1 to s and store the result in a register, then assign 10 to s, then=
 assign the register contents of the register to s. (Result: s =3D s + 1) T=
he compiler could also add 1 to s, store the result back to s, and then ass=
ign 10 to s. (Result: s =3D=3D 10). (Of course, undefined behavior means mo=
re than this, but these are the most likely actual behaviors by an actual c=
ompiler)<div>


2. No. That is semantically what occurs, but a compiler is under no obligat=
ion to actually do the operations in that order. (If it were done as separa=
te statements, the compiler would have no freedom to reorder here)</div>


<div>3.&nbsp;<span style=3D"font-family: arial,sans-serif; font-size: 13px;=
">stack.emplace(stack.top()++)</span><span style=3D"font-family: arial,sans=
-serif; font-size: 13px;">; is well defined because the evaluation of funct=
ion arguments is sequenced before the execution of a function. Therefore, t=
he ++ must occur before the emplacement (at least as far as observable beha=
vior of the program is concerned). See N3691 1.9 [intro.execution]/15:</spa=
n></div>


<blockquote style=3D"margin: 0px 0px 0px 40px; padding: 0px; border: black;=
 border-image: none;"><div><span style=3D"font-family: arial,sans-serif; fo=
nt-size: 13px;"><br></span></div><div><span style=3D"font-family: arial,san=
s-serif; font-size: 13px;"><div>When calling a function (whether or not the=
 function is inline), every value computation and side effect</div>


</span></div><div><span style=3D"font-family: arial,sans-serif; font-size: =
13px;"><div>associated with any argument expression, or with the postfix ex=
pression designating the called function, is</div></span></div><div><span s=
tyle=3D"font-family: arial,sans-serif; font-size: 13px;"><div>


sequenced before execution of every expression or statement in the body of =
the called function.</div></span></div></blockquote><span class=3D"HOEnZb">=
<font color=3D"#888888"><div><span style=3D"font-family: arial,sans-serif; =
font-size: 13px;"><div>

<br></div></span></div></font></span></div><span class=3D"HOEnZb"><font col=
or=3D"#888888">
</font></span><div class=3D"gmail_extra"><span class=3D"HOEnZb"><font color=
=3D"#888888"><br clear=3D"all"><div><div dir=3D"ltr"><div>Billy O'Neal</div=
><div><a href=3D"https://bitbucket.org/BillyONeal/" target=3D"_parent">http=
s://github.com/BillyONeal/</a></div>

<div><a href=3D"http://stackoverflow.com/users/82320/billy-oneal" target=3D=
"_parent">http://stackoverflow.com/users/82320/billy-oneal</a></div>
<div>Malware Response Instructor - BleepingComputer.com</div></div></div></=
font></span><div><div class=3D"h5">
<br><br><div class=3D"gmail_quote">On Fri, Dec 20, 2013 at 8:37 PM,  <span =
dir=3D"ltr">&lt;<a href=3D"mailto:euloanty@live.com" target=3D"_parent">eul=
oanty@live.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" s=
tyle=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rg=
b(204, 204, 204); border-left-width: 1px; border-left-style: solid;">


<div dir=3D"ltr"><div>1.about ++s:</div><div>int s(0);</div><div>++++s;</di=
v><div>++s=3D10;</div><div>Are&nbsp;they undefined behaviors?</div><div>But=
 if s is a "bigint" not a "int", they are well defined.</div>


<div><br></div><div>2.about s++:</div><div>Can we understand s++ as:</div><=
div>{</div><div>T temp(s);</div><div>++s;</div><div>return temp;</div><div>=
}</div><div><br></div><div>As&nbsp;I have&nbsp;found a question:</div><div>=
#include&lt;stack&gt;<br>


#include&lt;vector&gt;</div><div>int main()<br>{<br>&nbsp;std::stack&lt;int=
,std::vector&lt;int&gt;&gt; stack;<br>&nbsp;stack.emplace(3);<br>&nbsp;for(=
int i(0);i!=3D10000;++i)<br>&nbsp;&nbsp;stack.emplace(stack.top()++);&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp; //UB??<br>


&nbsp;return 0;<br>}</div><div><br></div><div>My understand on:</div><div>&=
nbsp;&nbsp;stack.emplace(stack.top()++);<br></div><div><br></div><div>is </=
div><div><br></div><div>{</div><div>&nbsp;&nbsp;auto temp(stack.top());</di=
v><div>&nbsp;&nbsp;++stack.top();</div>


<div><div>&nbsp;&nbsp;stack.emplace(temp);<br></div></div><div>}</div><div>=
..</div><div>For I have tried on G++,CLANG++,VC++, They all work as I think.=
</div><div>Am I right?</div><div><br></div><div>If stack is a std::stack&lt=
;bigint,std::vector&lt;bigint&gt;&gt; stack; not a std::stack&lt;int,std::v=
ector&lt;int&gt;&gt;; I'm sure that it works as I think.</div>


<div><div><br></div><div>int main()<br>{<br>&nbsp;std::stack&lt;bigint,std:=
:vector&lt;bigint&gt;&gt; stack;<br>&nbsp;stack.emplace(3);<br>&nbsp;for(in=
t i(0);i!=3D10000;++i)<br>&nbsp;&nbsp;stack.emplace(stack.top()++);&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp; //I am sure that it's not a UB.<br>


&nbsp;return 0;<br>}</div></div><div><br></div><div>If they are UBs, should=
 we expressed&nbsp;them correctly?</div></div><span><font color=3D"#888888"=
>

<p></p>

-- <br>
&nbsp;<br>
--- <br>
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org" target=3D=
"_parent">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_parent">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_parent">http://groups.google.com/a/isocpp.org/gr=
oup/std-proposals/</a>.<br>
</font></span></blockquote></div><br></div></div></div>
</blockquote></div><br></div>

<p></p>

-- <br>
&nbsp;<br>
--- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups "ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/RNWtBfjWXQk/unsubscribe" target=3D"_pare=
nt">https://groups.google.com/a/isocpp.org/d/topic/std-proposals/RNWtBfjWXQ=
k/unsubscribe</a>.<br>
To unsubscribe from this group and all its topics, send an email to std-pro=
posals+unsubscribe@isocpp.org.<br>
To post to this group, send email to std-proposals@isocpp.org.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_parent">http://groups.google.com/a/isocpp.org/gr=
oup/std-proposals/</a>.<br>
</div></div>
</body>
</html>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--_2D282236-F5F0-4EA0-9A6B-5208B241EDB7_--

.


Author: wsdwsd <euloanty@live.com>
Date: Sat, 21 Dec 2013 07:15:08 +0000
Raw View
--_3D25EEAA-6AA0-4BCD-8E96-9A1B5E9EA35D_
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=windows-1252

{

T temp(s);

++s;

return temp;

}



How can I understand I++?








Sent from Windows Mail





From: wsd wsd
Sent: Saturday, December 21, 2013 3:11 PM
To: std-proposals@isocpp.org





1. ++++s is ill formed.

I think it=92s no. In C++ Compiler, ++s return the reference of the s, so +=
+++s can be compiled by C++ compilers but not in C Compilers.

=20





Sent from Windows Mail





From: Billy O'Neal
Sent: Saturday, December 21, 2013 2:26 PM
To: std-proposals@isocpp.org





Ah, scratch what I said in #1 -- it is ill-formed in C but well-formed in C=
++. It still causes undefined behavior in this case though :)





Billy O'Neal

https://github.com/BillyONeal/

http://stackoverflow.com/users/82320/billy-oneal

Malware Response Instructor - BleepingComputer.com



On Fri, Dec 20, 2013 at 10:23 PM, Billy O'Neal <billy.oneal@gmail.com> wrot=
e:


1. ++++s is ill formed; ++ can only be applied to an lvalue. ++s =3D 10 is =
undefined behavior because the write to s as part of ++ and the write assig=
ning s to 10 are unsequenced. For instance, a compiler could add 1 to s and=
 store the result in a register, then assign 10 to s, then assign the regis=
ter contents of the register to s. (Result: s =3D s + 1) The compiler could=
 also add 1 to s, store the result back to s, and then assign 10 to s. (Res=
ult: s =3D=3D 10). (Of course, undefined behavior means more than this, but=
 these are the most likely actual behaviors by an actual compiler)
2. No. That is semantically what occurs, but a compiler is under no obligat=
ion to actually do the operations in that order. (If it were done as separa=
te statements, the compiler would have no freedom to reorder here)

3. stack.emplace(stack.top()++); is well defined because the evaluation of =
function arguments is sequenced before the execution of a function. Therefo=
re, the ++ must occur before the emplacement (at least as far as observable=
 behavior of the program is concerned). See N3691 1.9 [intro.execution]/15:






When calling a function (whether or not the function is inline), every valu=
e computation and side effect


associated with any argument expression, or with the postfix expression des=
ignating the called function, is


sequenced before execution of every expression or statement in the body of =
the called function.









Billy O'Neal

https://github.com/BillyONeal/

http://stackoverflow.com/users/82320/billy-oneal

Malware Response Instructor - BleepingComputer.com


=20


On Fri, Dec 20, 2013 at 8:37 PM, <euloanty@live.com> wrote:



1.about ++s:

int s(0);

++++s;

++s=3D10;

Are they undefined behaviors?

But if s is a "bigint" not a "int", they are well defined.




2.about s++:

Can we understand s++ as:

{

T temp(s);

++s;

return temp;

}




As I have found a question:

#include<stack>
#include<vector>

int main()
{
 std::stack<int,std::vector<int>> stack;
 stack.emplace(3);
 for(int i(0);i!=3D10000;++i)
  stack.emplace(stack.top()++);                            //UB??
 return 0;
}




My understand on:

  stack.emplace(stack.top()++);





is=20




{

  auto temp(stack.top());

  ++stack.top();


  stack.emplace(temp);


}

..

For I have tried on G++,CLANG++,VC++, They all work as I think.

Am I right?




If stack is a std::stack<bigint,std::vector<bigint>> stack; not a std::stac=
k<int,std::vector<int>>; I'm sure that it works as I think.





int main()
{
 std::stack<bigint,std::vector<bigint>> stack;
 stack.emplace(3);
 for(int i(0);i!=3D10000;++i)
  stack.emplace(stack.top()++);                            //I am sure that=
 it's not a UB.
 return 0;
}




If they are UBs, should we expressed them correctly?

--=20
=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.



--=20
=20
---=20
You received this message because you are subscribed to a topic in the Goog=
le Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this topic, visit https://groups.google.com/a/isocpp.or=
g/d/topic/std-proposals/RNWtBfjWXQk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to std-pro=
posals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--=20
=20
---=20
You received this message because you are subscribed to a topic in the Goog=
le Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this topic, visit https://groups.google.com/a/isocpp.or=
g/d/topic/std-proposals/RNWtBfjWXQk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to std-pro=
posals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--_3D25EEAA-6AA0-4BCD-8E96-9A1B5E9EA35D_
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=windows-1252


<html>
<head>
<meta name=3D"generator" content=3D"Windows Mail 17.5.9600.20315">
<style data-externalstyle=3D"true"><!--
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
}
p.MsoNormal, li.MsoNormal, div.MsoNormal {
margin:0in;
margin-bottom:.0001pt;
}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParag=
raphCxSpFirst,=20
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListPar=
agraphCxSpMiddle,=20
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagra=
phCxSpLast {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
line-height:115%;
}
--></style></head>
<body dir=3D"ltr">
<div data-externalstyle=3D"false" dir=3D"ltr" style=3D"font-family: 'Calibr=
i', 'Microsoft YaHei UI', 'Segoe UI', 'Meiryo', 'Microsoft JhengHei UI', 'M=
algun Gothic', 'sans-serif';font-size:12pt;"><div style=3D"color: rgb(0, 0,=
 0);">{</div><div style=3D"color: rgb(0, 0, 0);">T temp(s);</div><div style=
=3D"color: rgb(0, 0, 0);">++s;</div><div style=3D"color: rgb(0, 0, 0);">ret=
urn temp;</div><div style=3D"color: rgb(0, 0, 0);">}</div><div><br></div><d=
iv><br></div><div>How can I understand I++?</div><div style=3D"color: rgb(0=
, 0, 0);"><br></div><div style=3D"color: rgb(0, 0, 0);" data-signatureblock=
=3D"true"><div style=3D"color: rgb(0, 0, 0);"><br></div><div style=3D"color=
: rgb(0, 0, 0);">Sent from Windows Mail</div><div style=3D"color: rgb(0, 0,=
 0);"><br></div></div><div style=3D"padding-top: 5px; border-top-color: rgb=
(229, 229, 229); border-top-width: 1px; border-top-style: solid;"><div><fon=
t face=3D" 'Calibri', 'Microsoft YaHei UI', 'Segoe UI', 'Meiryo', 'Microsof=
t JhengHei UI', 'Malgun Gothic', 'sans-serif'" style=3D'line-height: 15pt; =
letter-spacing: 0.02em; font-family: "Calibri", "Microsoft YaHei UI", "Sego=
e UI", "Meiryo", "Microsoft JhengHei UI", "Malgun Gothic", "sans-serif"; fo=
nt-size: 12pt;'><b>From:</b>&nbsp;<a href=3D"mailto:euloanty@live.com" targ=
et=3D"_parent">wsd wsd</a><br><b>Sent:</b>&nbsp;Saturday, December 21, 2013=
 3:11 PM<br><b>To:</b>&nbsp;<a href=3D"mailto:std-proposals@isocpp.org" tar=
get=3D"_parent">std-proposals@isocpp.org</a></font></div></div><div><br></d=
iv><div dir=3D"ltr">
<div style=3D"color: rgb(0, 0, 0);">1. ++++s is ill formed.</div><div style=
=3D"color: rgb(0, 0, 0);">I think it=92s no. In C++ Compiler, ++s return th=
e reference of the s, so ++++s can be compiled by&nbsp;C++ compilers but no=
t in C Compilers.</div><div style=3D"color: rgb(0, 0, 0);">&nbsp;</div><div=
 style=3D"color: rgb(0, 0, 0);"><br></div><div style=3D"color: rgb(0, 0, 0)=
;" data-signatureblock=3D"true"><div style=3D"color: rgb(0, 0, 0);">Sent fr=
om Windows Mail</div><div style=3D"color: rgb(0, 0, 0);"><br></div></div><d=
iv style=3D"padding-top: 5px; border-top-color: rgb(229, 229, 229); border-=
top-width: 1px; border-top-style: solid;"><div><font face=3D" 'Calibri', 'M=
icrosoft YaHei UI', 'Segoe UI', 'Meiryo', 'Microsoft JhengHei UI', 'Malgun =
Gothic', 'sans-serif'" style=3D'line-height: 15pt; letter-spacing: 0.02em; =
font-family: "Calibri", "Microsoft YaHei UI", "Segoe UI", "Meiryo", "Micros=
oft JhengHei UI", "Malgun Gothic", "sans-serif"; font-size: 12pt;'><b>From:=
</b>&nbsp;<a href=3D"mailto:billy.oneal@gmail.com" target=3D"_parent">Billy=
 O'Neal</a><br><b>Sent:</b>&nbsp;Saturday, December 21, 2013 2:26 PM<br><b>=
To:</b>&nbsp;<a href=3D"mailto:std-proposals@isocpp.org" target=3D"_parent"=
>std-proposals@isocpp.org</a></font></div></div><div><br></div><div dir=3D"=
"><div dir=3D"ltr">Ah, scratch what I said in #1 -- it is ill-formed in C b=
ut well-formed in C++. It still causes undefined behavior in this case thou=
gh :)</div><div class=3D"gmail_extra"><br clear=3D"all"><div><div dir=3D"lt=
r"><div>

Billy O'Neal</div><div><a href=3D"https://bitbucket.org/BillyONeal/" target=
=3D"_parent">https://github.com/BillyONeal/</a></div><div><a href=3D"http:/=
/stackoverflow.com/users/82320/billy-oneal" target=3D"_parent">http://stack=
overflow.com/users/82320/billy-oneal</a></div>

<div>Malware Response Instructor - BleepingComputer.com</div></div></div>
<br><br><div class=3D"gmail_quote">On Fri, Dec 20, 2013 at 10:23 PM, Billy =
O'Neal <span dir=3D"ltr">&lt;<a href=3D"mailto:billy.oneal@gmail.com" targe=
t=3D"_parent">billy.oneal@gmail.com</a>&gt;</span> wrote:<br><blockquote cl=
ass=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; =
border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-=
style: solid;">

<div dir=3D"ltr">1. ++++s is ill formed; ++ can only be applied to an lvalu=
e. ++s =3D 10 is undefined behavior because the write to s as part of ++ an=
d the write assigning s to 10 are unsequenced. For instance, a compiler cou=
ld add 1 to s and store the result in a register, then assign 10 to s, then=
 assign the register contents of the register to s. (Result: s =3D s + 1) T=
he compiler could also add 1 to s, store the result back to s, and then ass=
ign 10 to s. (Result: s =3D=3D 10). (Of course, undefined behavior means mo=
re than this, but these are the most likely actual behaviors by an actual c=
ompiler)<div>


2. No. That is semantically what occurs, but a compiler is under no obligat=
ion to actually do the operations in that order. (If it were done as separa=
te statements, the compiler would have no freedom to reorder here)</div>


<div>3.&nbsp;<span style=3D"font-family: arial,sans-serif; font-size: 13px;=
">stack.emplace(stack.top()++)</span><span style=3D"font-family: arial,sans=
-serif; font-size: 13px;">; is well defined because the evaluation of funct=
ion arguments is sequenced before the execution of a function. Therefore, t=
he ++ must occur before the emplacement (at least as far as observable beha=
vior of the program is concerned). See N3691 1.9 [intro.execution]/15:</spa=
n></div>


<blockquote style=3D"margin: 0px 0px 0px 40px; padding: 0px; border: black;=
 border-image: none;"><div><span style=3D"font-family: arial,sans-serif; fo=
nt-size: 13px;"><br></span></div><div><span style=3D"font-family: arial,san=
s-serif; font-size: 13px;"><div>When calling a function (whether or not the=
 function is inline), every value computation and side effect</div>


</span></div><div><span style=3D"font-family: arial,sans-serif; font-size: =
13px;"><div>associated with any argument expression, or with the postfix ex=
pression designating the called function, is</div></span></div><div><span s=
tyle=3D"font-family: arial,sans-serif; font-size: 13px;"><div>


sequenced before execution of every expression or statement in the body of =
the called function.</div></span></div></blockquote><span class=3D"HOEnZb">=
<font color=3D"#888888"><div><span style=3D"font-family: arial,sans-serif; =
font-size: 13px;"><div>

<br></div></span></div></font></span></div><span class=3D"HOEnZb"><font col=
or=3D"#888888">
</font></span><div class=3D"gmail_extra"><span class=3D"HOEnZb"><font color=
=3D"#888888"><br clear=3D"all"><div><div dir=3D"ltr"><div>Billy O'Neal</div=
><div><a href=3D"https://bitbucket.org/BillyONeal/" target=3D"_parent">http=
s://github.com/BillyONeal/</a></div>

<div><a href=3D"http://stackoverflow.com/users/82320/billy-oneal" target=3D=
"_parent">http://stackoverflow.com/users/82320/billy-oneal</a></div>
<div>Malware Response Instructor - BleepingComputer.com</div></div></div></=
font></span><div><div class=3D"h5">
<br><br><div class=3D"gmail_quote">On Fri, Dec 20, 2013 at 8:37 PM,  <span =
dir=3D"ltr">&lt;<a href=3D"mailto:euloanty@live.com" target=3D"_parent">eul=
oanty@live.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" s=
tyle=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rg=
b(204, 204, 204); border-left-width: 1px; border-left-style: solid;">


<div dir=3D"ltr"><div>1.about ++s:</div><div>int s(0);</div><div>++++s;</di=
v><div>++s=3D10;</div><div>Are&nbsp;they undefined behaviors?</div><div>But=
 if s is a "bigint" not a "int", they are well defined.</div>


<div><br></div><div>2.about s++:</div><div>Can we understand s++ as:</div><=
div>{</div><div>T temp(s);</div><div>++s;</div><div>return temp;</div><div>=
}</div><div><br></div><div>As&nbsp;I have&nbsp;found a question:</div><div>=
#include&lt;stack&gt;<br>


#include&lt;vector&gt;</div><div>int main()<br>{<br>&nbsp;std::stack&lt;int=
,std::vector&lt;int&gt;&gt; stack;<br>&nbsp;stack.emplace(3);<br>&nbsp;for(=
int i(0);i!=3D10000;++i)<br>&nbsp;&nbsp;stack.emplace(stack.top()++);&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp; //UB??<br>


&nbsp;return 0;<br>}</div><div><br></div><div>My understand on:</div><div>&=
nbsp;&nbsp;stack.emplace(stack.top()++);<br></div><div><br></div><div>is </=
div><div><br></div><div>{</div><div>&nbsp;&nbsp;auto temp(stack.top());</di=
v><div>&nbsp;&nbsp;++stack.top();</div>


<div><div>&nbsp;&nbsp;stack.emplace(temp);<br></div></div><div>}</div><div>=
..</div><div>For I have tried on G++,CLANG++,VC++, They all work as I think.=
</div><div>Am I right?</div><div><br></div><div>If stack is a std::stack&lt=
;bigint,std::vector&lt;bigint&gt;&gt; stack; not a std::stack&lt;int,std::v=
ector&lt;int&gt;&gt;; I'm sure that it works as I think.</div>


<div><div><br></div><div>int main()<br>{<br>&nbsp;std::stack&lt;bigint,std:=
:vector&lt;bigint&gt;&gt; stack;<br>&nbsp;stack.emplace(3);<br>&nbsp;for(in=
t i(0);i!=3D10000;++i)<br>&nbsp;&nbsp;stack.emplace(stack.top()++);&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp; //I am sure that it's not a UB.<br>


&nbsp;return 0;<br>}</div></div><div><br></div><div>If they are UBs, should=
 we expressed&nbsp;them correctly?</div></div><span><font color=3D"#888888"=
>

<p></p>

-- <br>
&nbsp;<br>
--- <br>
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org" target=3D=
"_parent">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_parent">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_parent">http://groups.google.com/a/isocpp.org/gr=
oup/std-proposals/</a>.<br>
</font></span></blockquote></div><br></div></div></div>
</blockquote></div><br></div>

<p></p>

-- <br>
&nbsp;<br>
--- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups "ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/RNWtBfjWXQk/unsubscribe" target=3D"_pare=
nt">https://groups.google.com/a/isocpp.org/d/topic/std-proposals/RNWtBfjWXQ=
k/unsubscribe</a>.<br>
To unsubscribe from this group and all its topics, send an email to std-pro=
posals+unsubscribe@isocpp.org.<br>
To post to this group, send email to std-proposals@isocpp.org.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_parent">http://groups.google.com/a/isocpp.org/gr=
oup/std-proposals/</a>.<br>
</div>



<p></p>

-- <br>
&nbsp;<br>
--- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups "ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/RNWtBfjWXQk/unsubscribe" target=3D"_pare=
nt">https://groups.google.com/a/isocpp.org/d/topic/std-proposals/RNWtBfjWXQ=
k/unsubscribe</a>.<br>
To unsubscribe from this group and all its topics, send an email to std-pro=
posals+unsubscribe@isocpp.org.<br>
To post to this group, send email to std-proposals@isocpp.org.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_parent">http://groups.google.com/a/isocpp.org/gr=
oup/std-proposals/</a>.<br>
</div></div>
</body>
</html>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--_3D25EEAA-6AA0-4BCD-8E96-9A1B5E9EA35D_--

.


Author: wsdwsd <euloanty@live.com>
Date: Sat, 21 Dec 2013 20:22:03 +0800
Raw View
--_87da33ef-f78e-4a1f-94f2-bcf5ec38710d_
Content-Type: text/plain; charset=ISO-8859-1

I have some problems to ask you. Can I understand i++ in that order? I know compiler needn't do as that.  I don't know whether C++ std have asked compilers do the same things? I mean whether I can understand them in that order without errors.
And do you think
stack.emplace(stack.top()++);
could be written in my codes, for I couldn't do such a thing in a different way easily?
Sent from my Windows Phone
________________________________
From: Billy O'Neal<mailto:billy.oneal@gmail.com>
Sent: 2013/12/21 14:24
To: std-proposals<mailto:std-proposals@isocpp.org>
Subject: Re: [std-proposals] Some questions about ++ operator

1. ++++s is ill formed; ++ can only be applied to an lvalue. ++s = 10 is
undefined behavior because the write to s as part of ++ and the write
assigning s to 10 are unsequenced. For instance, a compiler could add 1 to
s and store the result in a register, then assign 10 to s, then assign the
register contents of the register to s. (Result: s = s + 1) The compiler
could also add 1 to s, store the result back to s, and then assign 10 to s.
(Result: s == 10). (Of course, undefined behavior means more than this, but
these are the most likely actual behaviors by an actual compiler)
2. No. That is semantically what occurs, but a compiler is under no
obligation to actually do the operations in that order. (If it were done as
separate statements, the compiler would have no freedom to reorder here)
3. stack.emplace(stack.top()++); is well defined because the evaluation of
function arguments is sequenced before the execution of a function.
Therefore, the ++ must occur before the emplacement (at least as far as
observable behavior of the program is concerned). See N3691 1.9
[intro.execution]/15:


When calling a function (whether or not the function is inline), every
value computation and side effect
associated with any argument expression, or with the postfix expression
designating the called function, is
sequenced before execution of every expression or statement in the body of
the called function.



Billy O'Neal
https://github.com/BillyONeal/ <https://bitbucket.org/BillyONeal/>
http://stackoverflow.com/users/82320/billy-oneal
Malware Response Instructor - BleepingComputer.com


On Fri, Dec 20, 2013 at 8:37 PM, <euloanty@live.com> wrote:

> 1.about ++s:
> int s(0);
> ++++s;
> ++s=10;
> Are they undefined behaviors?
> But if s is a "bigint" not a "int", they are well defined.
>
> 2.about s++:
> Can we understand s++ as:
> {
> T temp(s);
> ++s;
> return temp;
> }
>
> As I have found a question:
> #include<stack>
> #include<vector>
> int main()
> {
>  std::stack<int,std::vector<int>> stack;
>  stack.emplace(3);
>  for(int i(0);i!=10000;++i)
>   stack.emplace(stack.top()++);                            //UB??
>  return 0;
> }
>
> My understand on:
>   stack.emplace(stack.top()++);
>
> is
>
> {
>   auto temp(stack.top());
>   ++stack.top();
>   stack.emplace(temp);
> }
> .
> For I have tried on G++,CLANG++,VC++, They all work as I think.
> Am I right?
>
> If stack is a std::stack<bigint,std::vector<bigint>> stack; not a
> std::stack<int,std::vector<int>>; I'm sure that it works as I think.
>
> int main()
> {
>  std::stack<bigint,std::vector<bigint>> stack;
>  stack.emplace(3);
>  for(int i(0);i!=10000;++i)
>   stack.emplace(stack.top()++);                            //I am sure
> that it's not a UB.
>  return 0;
> }
>
> If they are UBs, should we expressed them correctly?
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--

---
You received this message because you are subscribed to a topic in the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this topic, visit https://groups.google.com/a/isocpp.org/d/topic/std-proposals/RNWtBfjWXQk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--_87da33ef-f78e-4a1f-94f2-bcf5ec38710d_
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8">
</head>
<body>
<div>
<div style=3D"FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif">I have some=
 problems to ask you. Can I understand i&#43;&#43; in that order? I know co=
mpiler needn't do as that.&nbsp; I don't know whether C&#43;&#43; std have =
asked compilers do the same things? I mean whether I can
 understand them in that order without errors.<br>
And do you think <br>
stack.emplace(stack.top()&#43;&#43;);<br>
could be written in my codes, for I couldn't do such a thing in a different=
 way easily?<br>
Sent from my Windows Phone</div>
</div>
<div dir=3D"ltr">
<hr>
<span style=3D"FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif; FONT-WEIGH=
T: bold">From:
</span><span style=3D"FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif"><a =
href=3D"mailto:billy.oneal@gmail.com">Billy O'Neal</a></span><br>
<span style=3D"FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif; FONT-WEIGH=
T: bold">Sent:
</span><span style=3D"FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif">201=
3/12/21 14:24</span><br>
<span style=3D"FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif; FONT-WEIGH=
T: bold">To:
</span><span style=3D"FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif"><a =
href=3D"mailto:std-proposals@isocpp.org">std-proposals</a></span><br>
<span style=3D"FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif; FONT-WEIGH=
T: bold">Subject:
</span><span style=3D"FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif">Re:=
 [std-proposals] Some questions about &#43;&#43; operator</span><br>
<br>
</div>
<div>
<div dir=3D"ltr">1. &#43;&#43;&#43;&#43;s is ill formed; &#43;&#43; can onl=
y be applied to an lvalue. &#43;&#43;s =3D 10 is undefined behavior because=
 the write to s as part of &#43;&#43; and the write assigning s to 10 are u=
nsequenced. For instance, a compiler could add 1 to s and store the result =
in
 a register, then assign 10 to s, then assign the register contents of the =
register to s. (Result: s =3D s &#43; 1) The compiler could also add 1 to s=
, store the result back to s, and then assign 10 to s. (Result: s =3D=3D 10=
). (Of course, undefined behavior means more
 than this, but these are the most likely actual behaviors by an actual com=
piler)
<div>2. No. That is semantically what occurs, but a compiler is under no ob=
ligation to actually do the operations in that order. (If it were done as s=
eparate statements, the compiler would have no freedom to reorder here)</di=
v>
<div>3.&nbsp;<span style=3D"font-size:13px; font-family:arial,sans-serif">s=
tack.emplace(stack.top()&#43;&#43;)</span><span style=3D"font-size:13px; fo=
nt-family:arial,sans-serif">; is well defined because the evaluation of fun=
ction arguments is sequenced before the execution
 of a function. Therefore, the &#43;&#43; must occur before the emplacement=
 (at least as far as observable behavior of the program is concerned). See =
N3691 1.9 [intro.execution]/15:</span></div>
<blockquote style=3D"margin:0 0 0 40px; border:none; padding:0px">
<div><span style=3D"font-size:13px; font-family:arial,sans-serif"><br>
</span></div>
<div><span style=3D"font-size:13px; font-family:arial,sans-serif">
<div>When calling a function (whether or not the function is inline), every=
 value computation and side effect</div>
</span></div>
<div><span style=3D"font-size:13px; font-family:arial,sans-serif">
<div>associated with any argument expression, or with the postfix expressio=
n designating the called function, is</div>
</span></div>
<div><span style=3D"font-size:13px; font-family:arial,sans-serif">
<div>sequenced before execution of every expression or statement in the bod=
y of the called function.</div>
</span></div>
</blockquote>
<div><span style=3D"font-size:13px; font-family:arial,sans-serif">
<div><br>
</div>
</span></div>
</div>
<div class=3D"x_gmail_extra"><br clear=3D"all">
<div>
<div dir=3D"ltr">
<div>Billy O'Neal</div>
<div><a href=3D"https://bitbucket.org/BillyONeal/" target=3D"_blank">https:=
//github.com/BillyONeal/</a></div>
<div><a href=3D"http://stackoverflow.com/users/82320/billy-oneal" target=3D=
"_blank">http://stackoverflow.com/users/82320/billy-oneal</a></div>
<div>Malware Response Instructor - BleepingComputer.com</div>
</div>
</div>
<br>
<br>
<div class=3D"x_gmail_quote">On Fri, Dec 20, 2013 at 8:37 PM, <span dir=3D"=
ltr">&lt;<a href=3D"mailto:euloanty@live.com" target=3D"_blank">euloanty@li=
ve.com</a>&gt;</span> wrote:<br>
<blockquote class=3D"x_gmail_quote" style=3D"margin:0 0 0 .8ex; border-left=
:1px #ccc solid; padding-left:1ex">
<div dir=3D"ltr">
<div>1.about &#43;&#43;s:</div>
<div>int s(0);</div>
<div>&#43;&#43;&#43;&#43;s;</div>
<div>&#43;&#43;s=3D10;</div>
<div>Are&nbsp;they undefined behaviors?</div>
<div>But if s is a &quot;bigint&quot; not a &quot;int&quot;, they are well =
defined.</div>
<div><br>
</div>
<div>2.about s&#43;&#43;:</div>
<div>Can we understand s&#43;&#43; as:</div>
<div>{</div>
<div>T temp(s);</div>
<div>&#43;&#43;s;</div>
<div>return temp;</div>
<div>}</div>
<div><br>
</div>
<div>As&nbsp;I have&nbsp;found a question:</div>
<div>#include&lt;stack&gt;<br>
#include&lt;vector&gt;</div>
<div>int main()<br>
{<br>
&nbsp;std::stack&lt;int,std::vector&lt;int&gt;&gt; stack;<br>
&nbsp;stack.emplace(3);<br>
&nbsp;for(int i(0);i!=3D10000;&#43;&#43;i)<br>
&nbsp;&nbsp;stack.emplace(stack.top()&#43;&#43;);&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //UB??<br>
&nbsp;return 0;<br>
}</div>
<div><br>
</div>
<div>My understand on:</div>
<div>&nbsp;&nbsp;stack.emplace(stack.top()&#43;&#43;);<br>
</div>
<div><br>
</div>
<div>is </div>
<div><br>
</div>
<div>{</div>
<div>&nbsp;&nbsp;auto temp(stack.top());</div>
<div>&nbsp;&nbsp;&#43;&#43;stack.top();</div>
<div>
<div>&nbsp;&nbsp;stack.emplace(temp);<br>
</div>
</div>
<div>}</div>
<div>.</div>
<div>For I have tried on G&#43;&#43;,CLANG&#43;&#43;,VC&#43;&#43;, They all=
 work as I think.</div>
<div>Am I right?</div>
<div><br>
</div>
<div>If stack is a std::stack&lt;bigint,std::vector&lt;bigint&gt;&gt; stack=
; not a std::stack&lt;int,std::vector&lt;int&gt;&gt;; I'm sure that it work=
s as I think.</div>
<div>
<div><br>
</div>
<div>int main()<br>
{<br>
&nbsp;std::stack&lt;bigint,std::vector&lt;bigint&gt;&gt; stack;<br>
&nbsp;stack.emplace(3);<br>
&nbsp;for(int i(0);i!=3D10000;&#43;&#43;i)<br>
&nbsp;&nbsp;stack.emplace(stack.top()&#43;&#43;);&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //I am sure t=
hat it's not a UB.<br>
&nbsp;return 0;<br>
}</div>
</div>
<div><br>
</div>
<div>If they are UBs, should we expressed&nbsp;them correctly?</div>
</div>
<span class=3D"x_HOEnZb"><font color=3D"#888888">
<p></p>
-- <br>
&nbsp;<br>
--- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C&#43;&#43; Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to
<a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org" target=3D"_blank"=
>std-proposals&#43;unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">
std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">
http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br>
</font></span></blockquote>
</div>
<br>
</div>
<p></p>
-- <br>
&nbsp;<br>
--- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups &quot;ISO C&#43;&#43; Standard - Future Proposals&quot; group.<br=
>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/RNWtBfjWXQk/unsubscribe">
https://groups.google.com/a/isocpp.org/d/topic/std-proposals/RNWtBfjWXQk/un=
subscribe</a>.<br>
To unsubscribe from this group and all its topics, send an email to std-pro=
posals&#43;unsubscribe@isocpp.org.<br>
To post to this group, send email to std-proposals@isocpp.org.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">
http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br>
</div>
</body>
</html>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--_87da33ef-f78e-4a1f-94f2-bcf5ec38710d_--

.


Author: Bo Persson <bop@gmb.dk>
Date: Sat, 21 Dec 2013 14:19:12 +0100
Raw View
wsdwsd skrev 2013-12-21 13:22:
> I have some problems to ask you. Can I understand i++ in that order? I
> know compiler needn't do as that.  I don't know whether C++ std have
> asked compilers do the same things? I mean whether I can understand them
> in that order without errors.
> And do you think
> stack.emplace(stack.top()++);
> could be written in my codes, for I couldn't do such a thing in a
> different way easily?

You could write stack.emplace(stack.top()++); , and it is guaranteed to
work. All parameters are fully evaluated, including their side effects,
before a function is called.


Bo Persson


> ------------------------------------------------------------------------
> From: Billy O'Neal <mailto:billy.oneal@gmail.com>
> Sent: 2013/12/21 14:24
> To: std-proposals <mailto:std-proposals@isocpp.org>
> Subject: Re: [std-proposals] Some questions about ++ operator
>
> 1. ++++s is ill formed; ++ can only be applied to an lvalue. ++s = 10 is
> undefined behavior because the write to s as part of ++ and the write
> assigning s to 10 are unsequenced. For instance, a compiler could add 1
> to s and store the result in a register, then assign 10 to s, then
> assign the register contents of the register to s. (Result: s = s + 1)
> The compiler could also add 1 to s, store the result back to s, and then
> assign 10 to s. (Result: s == 10). (Of course, undefined behavior means
> more than this, but these are the most likely actual behaviors by an
> actual compiler)
> 2. No. That is semantically what occurs, but a compiler is under no
> obligation to actually do the operations in that order. (If it were done
> as separate statements, the compiler would have no freedom to reorder here)
> 3. stack.emplace(stack.top()++); is well defined because the evaluation
> of function arguments is sequenced before the execution of a function.
> Therefore, the ++ must occur before the emplacement (at least as far as
> observable behavior of the program is concerned). See N3691 1.9
> [intro.execution]/15:
>
>
>     When calling a function (whether or not the function is inline),
>     every value computation and side effect
>     associated with any argument expression, or with the postfix
>     expression designating the called function, is
>     sequenced before execution of every expression or statement in the
>     body of the called function.
>
>
>
>
> On Fri, Dec 20, 2013 at 8:37 PM, <euloanty@live.com
> <mailto:euloanty@live.com>> wrote:
>
>     1.about ++s:
>     int s(0);
>     ++++s;
>     ++s=10;
>     Are they undefined behaviors?
>     But if s is a "bigint" not a "int", they are well defined.
>
>     2.about s++:
>     Can we understand s++ as:
>     {
>     T temp(s);
>     ++s;
>     return temp;
>     }
>
>     As I have found a question:
>     #include<stack>
>     #include<vector>
>     int main()
>     {
>       std::stack<int,std::vector<int>> stack;
>       stack.emplace(3);
>       for(int i(0);i!=10000;++i)
>        stack.emplace(stack.top()++);                            //UB??
>       return 0;
>     }
>
>     My understand on:
>        stack.emplace(stack.top()++);
>
>     is
>
>     {
>        auto temp(stack.top());
>        ++stack.top();
>        stack.emplace(temp);
>     }
>     .
>     For I have tried on G++,CLANG++,VC++, They all work as I think.
>     Am I right?
>
>     If stack is a std::stack<bigint,std::vector<bigint>> stack; not a
>     std::stack<int,std::vector<int>>; I'm sure that it works as I think.
>
>     int main()
>     {
>       std::stack<bigint,std::vector<bigint>> stack;
>       stack.emplace(3);
>       for(int i(0);i!=10000;++i)
>        stack.emplace(stack.top()++);                            //I am
>     sure that it's not a UB.
>       return 0;
>     }
>
>     If they are UBs, should we expressed them correctly?
>


--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: wsdwsd <euloanty@live.com>
Date: Sat, 21 Dec 2013 21:37:55 +0800
Raw View
--_3e829bb2-d183-4944-a346-6f6fb6554f8f_
Content-Type: text/plain; charset=ISO-8859-1

Thank you. And that question,can I understand the meaning of i++ like
int tmp(i);
++i
return tmp;
Without understanding errors?

I don't care how compilers do. I'd like to know if this kind of understand will bring errors to me?
I know most class objects are did as that, can I understand internal objects of that way?

Sent from my Windows Phone
________________________________
From: Bo Persson<mailto:bop@gmb.dk>
Sent: 2013/12/21 21:19
To: std-proposals@isocpp.org<mailto:std-proposals@isocpp.org>
Subject: [std-proposals] Re: Some questions about ++ operator

wsdwsd skrev 2013-12-21 13:22:
> I have some problems to ask you. Can I understand i++ in that order? I
> know compiler needn't do as that.  I don't know whether C++ std have
> asked compilers do the same things? I mean whether I can understand them
> in that order without errors.
> And do you think
> stack.emplace(stack.top()++);
> could be written in my codes, for I couldn't do such a thing in a
> different way easily?

You could write stack.emplace(stack.top()++); , and it is guaranteed to
work. All parameters are fully evaluated, including their side effects,
before a function is called.


Bo Persson


> ------------------------------------------------------------------------
> From: Billy O'Neal <mailto:billy.oneal@gmail.com>
> Sent: 2013/12/21 14:24
> To: std-proposals <mailto:std-proposals@isocpp.org>
> Subject: Re: [std-proposals] Some questions about ++ operator
>
> 1. ++++s is ill formed; ++ can only be applied to an lvalue. ++s = 10 is
> undefined behavior because the write to s as part of ++ and the write
> assigning s to 10 are unsequenced. For instance, a compiler could add 1
> to s and store the result in a register, then assign 10 to s, then
> assign the register contents of the register to s. (Result: s = s + 1)
> The compiler could also add 1 to s, store the result back to s, and then
> assign 10 to s. (Result: s == 10). (Of course, undefined behavior means
> more than this, but these are the most likely actual behaviors by an
> actual compiler)
> 2. No. That is semantically what occurs, but a compiler is under no
> obligation to actually do the operations in that order. (If it were done
> as separate statements, the compiler would have no freedom to reorder here)
> 3. stack.emplace(stack.top()++); is well defined because the evaluation
> of function arguments is sequenced before the execution of a function.
> Therefore, the ++ must occur before the emplacement (at least as far as
> observable behavior of the program is concerned). See N3691 1.9
> [intro.execution]/15:
>
>
>     When calling a function (whether or not the function is inline),
>     every value computation and side effect
>     associated with any argument expression, or with the postfix
>     expression designating the called function, is
>     sequenced before execution of every expression or statement in the
>     body of the called function.
>
>
>
>
> On Fri, Dec 20, 2013 at 8:37 PM, <euloanty@live.com
> <mailto:euloanty@live.com>> wrote:
>
>     1.about ++s:
>     int s(0);
>     ++++s;
>     ++s=10;
>     Are they undefined behaviors?
>     But if s is a "bigint" not a "int", they are well defined.
>
>     2.about s++:
>     Can we understand s++ as:
>     {
>     T temp(s);
>     ++s;
>     return temp;
>     }
>
>     As I have found a question:
>     #include<stack>
>     #include<vector>
>     int main()
>     {
>       std::stack<int,std::vector<int>> stack;
>       stack.emplace(3);
>       for(int i(0);i!=10000;++i)
>        stack.emplace(stack.top()++);                            //UB??
>       return 0;
>     }
>
>     My understand on:
>        stack.emplace(stack.top()++);
>
>     is
>
>     {
>        auto temp(stack.top());
>        ++stack.top();
>        stack.emplace(temp);
>     }
>     .
>     For I have tried on G++,CLANG++,VC++, They all work as I think.
>     Am I right?
>
>     If stack is a std::stack<bigint,std::vector<bigint>> stack; not a
>     std::stack<int,std::vector<int>>; I'm sure that it works as I think.
>
>     int main()
>     {
>       std::stack<bigint,std::vector<bigint>> stack;
>       stack.emplace(3);
>       for(int i(0);i!=10000;++i)
>        stack.emplace(stack.top()++);                            //I am
>     sure that it's not a UB.
>       return 0;
>     }
>
>     If they are UBs, should we expressed them correctly?
>


--

---
You received this message because you are subscribed to a topic in the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this topic, visit https://groups.google.com/a/isocpp.org/d/topic/std-proposals/RNWtBfjWXQk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--_3e829bb2-d183-4944-a346-6f6fb6554f8f_
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8">
</head>
<body>
<div>
<div style=3D"FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif">Thank you. =
And that question,can I understand the meaning of i&#43;&#43; like
<br>
int tmp(i);<br>
&#43;&#43;i<br>
return tmp;<br>
Without understanding errors?<br>
<br>
I don't care how compilers do. I'd like to know if this kind of understand =
will bring errors to me?
<br>
I know most class objects are did as that, can I understand internal object=
s of that way?<br>
<br>
Sent from my Windows Phone</div>
</div>
<div dir=3D"ltr">
<hr>
<span style=3D"FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif; FONT-WEIGH=
T: bold">From:
</span><span style=3D"FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif"><a =
href=3D"mailto:bop@gmb.dk">Bo Persson</a></span><br>
<span style=3D"FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif; FONT-WEIGH=
T: bold">Sent:
</span><span style=3D"FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif">201=
3/12/21 21:19</span><br>
<span style=3D"FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif; FONT-WEIGH=
T: bold">To:
</span><span style=3D"FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif"><a =
href=3D"mailto:std-proposals@isocpp.org">std-proposals@isocpp.org</a></span=
><br>
<span style=3D"FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif; FONT-WEIGH=
T: bold">Subject:
</span><span style=3D"FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif">[st=
d-proposals] Re: Some questions about &#43;&#43; operator</span><br>
<br>
</div>
<div class=3D"BodyFragment">
<div class=3D"PlainText">wsdwsd skrev 2013-12-21 13:22:<br>
&gt; I have some problems to ask you. Can I understand i&#43;&#43; in that =
order? I<br>
&gt; know compiler needn't do as that.&nbsp; I don't know whether C&#43;&#4=
3; std have<br>
&gt; asked compilers do the same things? I mean whether I can understand th=
em<br>
&gt; in that order without errors.<br>
&gt; And do you think<br>
&gt; stack.emplace(stack.top()&#43;&#43;);<br>
&gt; could be written in my codes, for I couldn't do such a thing in a<br>
&gt; different way easily?<br>
<br>
You could write stack.emplace(stack.top()&#43;&#43;); , and it is guarantee=
d to <br>
work. All parameters are fully evaluated, including their side effects, <br=
>
before a function is called.<br>
<br>
<br>
Bo Persson<br>
<br>
<br>
&gt; ----------------------------------------------------------------------=
--<br>
&gt; From: Billy O'Neal &lt;<a href=3D"mailto:billy.oneal@gmail.com">mailto=
:billy.oneal@gmail.com</a>&gt;<br>
&gt; Sent: 2013/12/21 14:24<br>
&gt; To: std-proposals &lt;<a href=3D"mailto:std-proposals@isocpp.org">mail=
to:std-proposals@isocpp.org</a>&gt;<br>
&gt; Subject: Re: [std-proposals] Some questions about &#43;&#43; operator<=
br>
&gt;<br>
&gt; 1. &#43;&#43;&#43;&#43;s is ill formed; &#43;&#43; can only be applied=
 to an lvalue. &#43;&#43;s =3D 10 is<br>
&gt; undefined behavior because the write to s as part of &#43;&#43; and th=
e write<br>
&gt; assigning s to 10 are unsequenced. For instance, a compiler could add =
1<br>
&gt; to s and store the result in a register, then assign 10 to s, then<br>
&gt; assign the register contents of the register to s. (Result: s =3D s &#=
43; 1)<br>
&gt; The compiler could also add 1 to s, store the result back to s, and th=
en<br>
&gt; assign 10 to s. (Result: s =3D=3D 10). (Of course, undefined behavior =
means<br>
&gt; more than this, but these are the most likely actual behaviors by an<b=
r>
&gt; actual compiler)<br>
&gt; 2. No. That is semantically what occurs, but a compiler is under no<br=
>
&gt; obligation to actually do the operations in that order. (If it were do=
ne<br>
&gt; as separate statements, the compiler would have no freedom to reorder =
here)<br>
&gt; 3. stack.emplace(stack.top()&#43;&#43;); is well defined because the e=
valuation<br>
&gt; of function arguments is sequenced before the execution of a function.=
<br>
&gt; Therefore, the &#43;&#43; must occur before the emplacement (at least =
as far as<br>
&gt; observable behavior of the program is concerned). See N3691 1.9<br>
&gt; [intro.execution]/15:<br>
&gt;<br>
&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; When calling a function (whether or not the fu=
nction is inline),<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; every value computation and side effect<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; associated with any argument expression, or wi=
th the postfix<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; expression designating the called function, is=
<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; sequenced before execution of every expression=
 or statement in the<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; body of the called function.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Fri, Dec 20, 2013 at 8:37 PM, &lt;euloanty@live.com<br>
&gt; &lt;<a href=3D"mailto:euloanty@live.com">mailto:euloanty@live.com</a>&=
gt;&gt; wrote:<br>
&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; 1.about &#43;&#43;s:<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; int s(0);<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; &#43;&#43;&#43;&#43;s;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; &#43;&#43;s=3D10;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; Are they undefined behaviors?<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; But if s is a &quot;bigint&quot; not a &quot;i=
nt&quot;, they are well defined.<br>
&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; 2.about s&#43;&#43;:<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; Can we understand s&#43;&#43; as:<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; T temp(s);<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; &#43;&#43;s;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; return temp;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; As I have found a question:<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; #include&lt;stack&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; #include&lt;vector&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; int main()<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::stack&lt;int,std::vector&lt;i=
nt&gt;&gt; stack;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stack.emplace(3);<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for(int i(0);i!=3D10000;&#43;&#43;=
i)<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stack.emplace(stack.top()&#4=
3;&#43;);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp; //UB??<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 0;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; My understand on:<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stack.emplace(stack.top()&#4=
3;&#43;);<br>
&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; is<br>
&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; auto temp(stack.top());<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#43;&#43;stack.top();<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stack.emplace(temp);<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; .<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; For I have tried on G&#43;&#43;,CLANG&#43;&#43=
;,VC&#43;&#43;, They all work as I think.<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; Am I right?<br>
&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; If stack is a std::stack&lt;bigint,std::vector=
&lt;bigint&gt;&gt; stack; not a<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; std::stack&lt;int,std::vector&lt;int&gt;&gt;; =
I'm sure that it works as I think.<br>
&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; int main()<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::stack&lt;bigint,std::vector&l=
t;bigint&gt;&gt; stack;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stack.emplace(3);<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for(int i(0);i!=3D10000;&#43;&#43;=
i)<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stack.emplace(stack.top()&#4=
3;&#43;);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp; //I am<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; sure that it's not a UB.<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 0;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&gt;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; If they are UBs, should we expressed them corr=
ectly?<br>
&gt;<br>
<br>
<br>
-- <br>
<br>
--- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups &quot;ISO C&#43;&#43; Standard - Future Proposals&quot; group.<br=
>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/RNWtBfjWXQk/unsubscribe">
https://groups.google.com/a/isocpp.org/d/topic/std-proposals/RNWtBfjWXQk/un=
subscribe</a>.<br>
To unsubscribe from this group and all its topics, send an email to std-pro=
posals&#43;unsubscribe@isocpp.org.<br>
To post to this group, send email to std-proposals@isocpp.org.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">
http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br>
</div>
</div>
</body>
</html>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--_3e829bb2-d183-4944-a346-6f6fb6554f8f_--

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Sat, 21 Dec 2013 08:13:48 -0800
Raw View
On s=E1bado, 21 de dezembro de 2013 21:37:55, wsdwsd wrote:
> Thank you. And that question,can I understand the meaning of i++ like
> int tmp(i);
> ++i
> return tmp;
> Without understanding errors?
>=20
> I don't care how compilers do. I'd like to know if this kind of understan=
d
> will bring errors to me? I know most class objects are did as that, can I
> understand internal objects of that way?

I don't know about others, but I'm still struggling to understand what you=
=20
want to propose. I understand you're asking questions about what's currentl=
y=20
defined and not, but please tell us what you want to propose to C++. It wil=
l be=20
better for us to advise you if we understand your end-goal.

See also: http://meta.stackoverflow.com/questions/66377/what-is-the-xy-prob=
lem

--=20
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

.


Author: wsdwsd <euloanty@live.com>
Date: Sat, 21 Dec 2013 17:12:01 +0000
Raw View
--_0C6F3C21-2A26-4A94-8386-C152A889C25A_
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1

Thank you. What I want is to make internal types work as same as class type=
s.


As a iterator:

iter++ equals to

auto iter_temp(iter);

++iter;

return iter_temp;


But as a internal-type, what i++ means? Is it:




int i(0);

Does i++ equal to:
auto temp(i);
++i;

return temp;

?






Sent from Windows Mail





From: Thiago Macieira
Sent: Sunday, December 22, 2013 12:13 AM
To: std-proposals@isocpp.org





On s=E1bado, 21 de dezembro de 2013 21:37:55, wsdwsd wrote:
> Thank you. And that question,can I understand the meaning of i++ like
> int tmp(i);
> ++i
> return tmp;
> Without understanding errors?
>=20
> I don't care how compilers do. I'd like to know if this kind of understan=
d
> will bring errors to me? I know most class objects are did as that, can I
> understand internal objects of that way?

I don't know about others, but I'm still struggling to understand what you=
=20
want to propose. I understand you're asking questions about what's currentl=
y=20
defined and not, but please tell us what you want to propose to C++. It wil=
l be=20
better for us to advise you if we understand your end-goal.

See also: http://meta.stackoverflow.com/questions/66377/what-is-the-xy-prob=
lem

--=20
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

--=20

---=20
You received this message because you are subscribed to a topic in the Goog=
le Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this topic, visit https://groups.google.com/a/isocpp.or=
g/d/topic/std-proposals/RNWtBfjWXQk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to std-pro=
posals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--_0C6F3C21-2A26-4A94-8386-C152A889C25A_
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1


<html>
<head>
<meta name=3D"generator" content=3D"Windows Mail 17.5.9600.20315">
<style><!--
..EmailQuote {
margin-left:1pt;
padding-left:4pt;
border-left:#800000 2px solid;
}
--></style><style data-externalstyle=3D"true"><!--
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
}
p.MsoNormal, li.MsoNormal, div.MsoNormal {
margin:0in;
margin-bottom:.0001pt;
}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParag=
raphCxSpFirst,=20
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListPar=
agraphCxSpMiddle,=20
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagra=
phCxSpLast {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
line-height:115%;
}
--></style></head>
<body dir=3D"ltr">
<div data-externalstyle=3D"false" dir=3D"ltr" style=3D"font-family: 'Calibr=
i', 'Microsoft YaHei UI', 'Segoe UI', 'Meiryo', 'Microsoft JhengHei UI', 'M=
algun Gothic', 'sans-serif';font-size:12pt;"><div style=3D"color: rgb(0, 0,=
 0);">Thank you.&nbsp;What I want&nbsp;is to make internal types work as sa=
me as class types.</div><div style=3D"color: rgb(0, 0, 0);"><br></div><div =
style=3D"color: rgb(0, 0, 0);">As a iterator:</div><div style=3D"color: rgb=
(0, 0, 0);">iter++ equals to</div><div style=3D"color: rgb(0, 0, 0);">auto =
iter_temp(iter);</div><div style=3D"color: rgb(0, 0, 0);">++iter;</div><div=
 style=3D"color: rgb(0, 0, 0);">return iter_temp;</div><div style=3D"color:=
 rgb(0, 0, 0);"><br></div><div style=3D"color: rgb(0, 0, 0);">But as a inte=
rnal-type, what i++ means? Is it:</div><div style=3D"color: rgb(0, 0, 0);">=
<div style=3D"color: rgb(0, 0, 0);"><div style=3D"color: rgb(0, 0, 0);"><br=
></div><div style=3D"color: rgb(0, 0, 0);">int i(0);</div><div style=3D"col=
or: rgb(0, 0, 0);">Does&nbsp;i++ equal to:</div>auto temp(i);</div><div sty=
le=3D"color: rgb(0, 0, 0);">++i;</div><div style=3D"color: rgb(0, 0, 0);">r=
eturn temp;</div></div><div style=3D"color: rgb(0, 0, 0);">?<br></div><div =
style=3D"color: rgb(0, 0, 0);" data-signatureblock=3D"true"><div style=3D"c=
olor: rgb(0, 0, 0);"><br></div><div style=3D"color: rgb(0, 0, 0);">Sent fro=
m Windows Mail</div><div style=3D"color: rgb(0, 0, 0);"><br></div></div><di=
v style=3D"padding-top: 5px; border-top-color: rgb(229, 229, 229); border-t=
op-width: 1px; border-top-style: solid;"><div><font face=3D" 'Calibri', 'Mi=
crosoft YaHei UI', 'Segoe UI', 'Meiryo', 'Microsoft JhengHei UI', 'Malgun G=
othic', 'sans-serif'" style=3D'line-height: 15pt; letter-spacing: 0.02em; f=
ont-family: "Calibri", "Microsoft YaHei UI", "Segoe UI", "Meiryo", "Microso=
ft JhengHei UI", "Malgun Gothic", "sans-serif"; font-size: 12pt;'><b>From:<=
/b>&nbsp;<a href=3D"mailto:thiago@macieira.org" target=3D"_parent">Thiago M=
acieira</a><br><b>Sent:</b>&nbsp;Sunday, December 22, 2013 12:13 AM<br><b>T=
o:</b>&nbsp;<a href=3D"mailto:std-proposals@isocpp.org" target=3D"_parent">=
std-proposals@isocpp.org</a></font></div></div><div><br></div><div dir=3D""=
>
<div class=3D"PlainText">On s=E1bado, 21 de dezembro de 2013 21:37:55, wsdw=
sd wrote:<br>
&gt; Thank you. And that question,can I understand the meaning of i++ like<=
br>
&gt; int tmp(i);<br>
&gt; ++i<br>
&gt; return tmp;<br>
&gt; Without understanding errors?<br>
&gt; <br>
&gt; I don't care how compilers do. I'd like to know if this kind of unders=
tand<br>
&gt; will bring errors to me? I know most class objects are did as that, ca=
n I<br>
&gt; understand internal objects of that way?<br>
<br>
I don't know about others, but I'm still struggling to understand what you =
<br>
want to propose. I understand you're asking questions about what's currentl=
y <br>
defined and not, but please tell us what you want to propose to C++. It wil=
l be <br>
better for us to advise you if we understand your end-goal.<br>
<br>
See also: <a href=3D"http://meta.stackoverflow.com/questions/66377/what-is-=
the-xy-problem" target=3D"_parent">http://meta.stackoverflow.com/questions/=
66377/what-is-the-xy-problem</a><br>
<br>
-- <br>
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org<br>
&nbsp;&nbsp; Software Architect - Intel Open Source Technology Center<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PGP/GPG: 0x6EF45358; fingerprint:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; E067 918B B660 DBD1 105C&nbsp; 966C 33F5 F00=
5 6EF4 5358<br>
<br>
-- <br>
<br>
--- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups "ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/RNWtBfjWXQk/unsubscribe" target=3D"_pare=
nt">https://groups.google.com/a/isocpp.org/d/topic/std-proposals/RNWtBfjWXQ=
k/unsubscribe</a>.<br>
To unsubscribe from this group and all its topics, send an email to std-pro=
posals+unsubscribe@isocpp.org.<br>
To post to this group, send email to std-proposals@isocpp.org.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_parent">http://groups.google.com/a/isocpp.org/gr=
oup/std-proposals/</a>.<br>
</div>


</div></div>
</body>
</html>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--_0C6F3C21-2A26-4A94-8386-C152A889C25A_--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Sat, 21 Dec 2013 19:35:28 +0200
Raw View
On 21 December 2013 19:12, wsdwsd <euloanty@live.com> wrote:
> Thank you. What I want is to make internal types work as same as class
> types.

That's not a standard proposal, since they already can be made to work the
same. Therefore this is completely off-topic.

>
> As a iterator:
> iter++ equals to
> auto iter_temp(iter);
> ++iter;
> return iter_temp;
>
> But as a internal-type, what i++ means? Is it:
>
> int i(0);
> Does i++ equal to:
> auto temp(i);
> ++i;
> return temp;
> ?

I don't know what that int i(0); is doing there, but otherwise the
answer is yes.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: wsdwsd <euloanty@live.com>
Date: Sun, 22 Dec 2013 07:43:18 +0800
Raw View
--_36eab6d2-d6da-4d80-9e51-cf34caec1149_
Content-Type: text/plain; charset=ISO-8859-1

int i(0);
==
int i=0;
I'd like to tell you I is a int.

Sent from my Windows Phone
________________________________
From: Ville Voutilainen<mailto:ville.voutilainen@gmail.com>
Sent: 2013/12/22 1:35
To: std-proposals@isocpp.org<mailto:std-proposals@isocpp.org>
Subject: Re: [std-proposals] Re: Some questions about ++ operator

On 21 December 2013 19:12, wsdwsd <euloanty@live.com> wrote:
> Thank you. What I want is to make internal types work as same as class
> types.

That's not a standard proposal, since they already can be made to work the
same. Therefore this is completely off-topic.

>
> As a iterator:
> iter++ equals to
> auto iter_temp(iter);
> ++iter;
> return iter_temp;
>
> But as a internal-type, what i++ means? Is it:
>
> int i(0);
> Does i++ equal to:
> auto temp(i);
> ++i;
> return temp;
> ?

I don't know what that int i(0); is doing there, but otherwise the
answer is yes.

--

---
You received this message because you are subscribed to a topic in the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this topic, visit https://groups.google.com/a/isocpp.org/d/topic/std-proposals/RNWtBfjWXQk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--_36eab6d2-d6da-4d80-9e51-cf34caec1149_
Content-Type: text/html; charset=ISO-8859-1

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div>
<div style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif">int i(0);<br>
==<br>
int i=0;<br>
I'd like to tell you I is a int.<br>
<br>
Sent from my Windows Phone</div>
</div>
<div dir="ltr">
<hr>
<span style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif; FONT-WEIGHT: bold">From:
</span><span style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif"><a href="mailto:ville.voutilainen@gmail.com">Ville Voutilainen</a></span><br>
<span style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif; FONT-WEIGHT: bold">Sent:
</span><span style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif">2013/12/22 1:35</span><br>
<span style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif; FONT-WEIGHT: bold">To:
</span><span style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif"><a href="mailto:std-proposals@isocpp.org">std-proposals@isocpp.org</a></span><br>
<span style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif; FONT-WEIGHT: bold">Subject:
</span><span style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif">Re: [std-proposals] Re: Some questions about &#43;&#43; operator</span><br>
<br>
</div>
<div class="BodyFragment">
<div class="PlainText">On 21 December 2013 19:12, wsdwsd &lt;euloanty@live.com&gt; wrote:<br>
&gt; Thank you. What I want is to make internal types work as same as class<br>
&gt; types.<br>
<br>
That's not a standard proposal, since they already can be made to work the<br>
same. Therefore this is completely off-topic.<br>
<br>
&gt;<br>
&gt; As a iterator:<br>
&gt; iter&#43;&#43; equals to<br>
&gt; auto iter_temp(iter);<br>
&gt; &#43;&#43;iter;<br>
&gt; return iter_temp;<br>
&gt;<br>
&gt; But as a internal-type, what i&#43;&#43; means? Is it:<br>
&gt;<br>
&gt; int i(0);<br>
&gt; Does i&#43;&#43; equal to:<br>
&gt; auto temp(i);<br>
&gt; &#43;&#43;i;<br>
&gt; return temp;<br>
&gt; ?<br>
<br>
I don't know what that int i(0); is doing there, but otherwise the<br>
answer is yes.<br>
<br>
-- <br>
<br>
--- <br>
You received this message because you are subscribed to a topic in the Google Groups &quot;ISO C&#43;&#43; Standard - Future Proposals&quot; group.<br>
To unsubscribe from this topic, visit <a href="https://groups.google.com/a/isocpp.org/d/topic/std-proposals/RNWtBfjWXQk/unsubscribe">
https://groups.google.com/a/isocpp.org/d/topic/std-proposals/RNWtBfjWXQk/unsubscribe</a>.<br>
To unsubscribe from this group and all its topics, send an email to std-proposals&#43;unsubscribe@isocpp.org.<br>
To post to this group, send email to std-proposals@isocpp.org.<br>
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/">
http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br>
</div>
</div>
</body>
</html>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br />

--_36eab6d2-d6da-4d80-9e51-cf34caec1149_--

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Sat, 21 Dec 2013 18:17:06 -0600
Raw View
On s=E1bado, 21 de dezembro de 2013 17:12:01, wsdwsd wrote:
> Thank you. What I want is to make internal types work as same as class
> types.

Why? It's been like that for the entire history of C++, and for 40 years if=
=20
you count the history of C before it.

Generally, whenever the standard says explicitly that something is undefine=
d=20
behaviour, it has a good reason to do it. Often having to do with letting t=
he=20
compiler have freedom to optimise. Undefined behaviours are not bugs. they =
are=20
intentional. So you must have a very good reason to change them.

Note also that your problem isn't the operations actually performed, but th=
e=20
fact that they're unsequenced with relation to other things happening aroun=
d=20
the same time. If you're going to require the sequencing, please make sure=
=20
that you understand the implications of doing it.

--=20
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

.


Author: Johannes Schaub <schaub.johannes@googlemail.com>
Date: Sun, 22 Dec 2013 03:13:21 +0100
Raw View
--047d7b33c9dc29b84204ee160ef8
Content-Type: text/plain; charset=ISO-8859-1

Am 21.12.2013 07:24 schrieb "Billy O'Neal" <billy.oneal@gmail.com>:
>
> . ++s = 10 is undefined behavior because the write to s as part of ++ and
the write assigning s to 10 are unsequenced.

This is wrong. ++s = 10 is well defined.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--047d7b33c9dc29b84204ee160ef8
Content-Type: text/html; charset=ISO-8859-1

<p dir="ltr"><br>
Am 21.12.2013 07:24 schrieb &quot;Billy O&#39;Neal&quot; &lt;<a href="mailto:billy.oneal@gmail.com">billy.oneal@gmail.com</a>&gt;:<br>
&gt;<br>
&gt; . ++s = 10 is undefined behavior because the write to s as part of ++ and the write assigning s to 10 are unsequenced.</p>
<p dir="ltr">This is wrong. ++s = 10 is well defined.</p>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br />

--047d7b33c9dc29b84204ee160ef8--

.


Author: "Billy O'Neal" <billy.oneal@gmail.com>
Date: Sat, 21 Dec 2013 18:29:30 -0800
Raw View
--047d7b5d25e450c25c04ee164a90
Content-Type: text/plain; charset=ISO-8859-1

If so, then why is that?

Billy O'Neal
https://github.com/BillyONeal/ <https://bitbucket.org/BillyONeal/>
http://stackoverflow.com/users/82320/billy-oneal
Malware Response Instructor - BleepingComputer.com


On Sat, Dec 21, 2013 at 6:13 PM, Johannes Schaub <
schaub.johannes@googlemail.com> wrote:

>
> Am 21.12.2013 07:24 schrieb "Billy O'Neal" <billy.oneal@gmail.com>:
> >
> > . ++s = 10 is undefined behavior because the write to s as part of ++
> and the write assigning s to 10 are unsequenced.
>
> This is wrong. ++s = 10 is well defined.
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--047d7b5d25e450c25c04ee164a90
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">If so, then why is that?</div><div class=3D"gmail_extra"><=
br clear=3D"all"><div><div dir=3D"ltr"><div>Billy O&#39;Neal</div><div><a h=
ref=3D"https://bitbucket.org/BillyONeal/" target=3D"_blank">https://github.=
com/BillyONeal/</a></div>

<div><a href=3D"http://stackoverflow.com/users/82320/billy-oneal" target=3D=
"_blank">http://stackoverflow.com/users/82320/billy-oneal</a></div><div>Mal=
ware Response Instructor - BleepingComputer.com</div></div></div>
<br><br><div class=3D"gmail_quote">On Sat, Dec 21, 2013 at 6:13 PM, Johanne=
s Schaub <span dir=3D"ltr">&lt;<a href=3D"mailto:schaub.johannes@googlemail=
..com" target=3D"_blank">schaub.johannes@googlemail.com</a>&gt;</span> wrote=
:<br>

<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><p dir=3D"ltr"><br>
Am 21.12.2013 07:24 schrieb &quot;Billy O&#39;Neal&quot; &lt;<a href=3D"mai=
lto:billy.oneal@gmail.com" target=3D"_blank">billy.oneal@gmail.com</a>&gt;:=
<br>
&gt;<br>
&gt; . ++s =3D 10 is undefined behavior because the write to s as part of +=
+ and the write assigning s to 10 are unsequenced.</p>
<p dir=3D"ltr">This is wrong. ++s =3D 10 is well defined.</p><span class=3D=
"HOEnZb"><font color=3D"#888888">

<p></p>

-- <br>
=A0<br>
--- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org" target=3D=
"_blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</font></span></blockquote></div><br></div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--047d7b5d25e450c25c04ee164a90--

.


Author: David Krauss <potswa@gmail.com>
Date: Sun, 22 Dec 2013 11:31:08 +0800
Raw View
This is a multi-part message in MIME format.
--------------070906030505060906070001
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: quoted-printable

Is this discussion on-topic here? This isn't the std-discussion list,=20
but even if it were, this would all be answered much faster on=20
StackOverflow, likely by linking to a preexisting Q&A page.

Simply referring to the C++11 spec, "The result [of prefix ++] is the=20
updated operand; it is an lvalue=85", C++ International Standard and of=20
compound assignment expressions to which prefix ++ is equivalent, "In=20
all cases, the assignment is sequenced after the value computation of=20
the right and left operands, and before the value computation of the=20
assignment expression."

It doesn't really matter anyway; you shouldn't write ++s=3D10 or ++++s=20
whether or not it's well-defined. To play devil's advocate, such=20
expressions may be produced by macros, but only the sort of macro that=20
should be replaced by an inline function.

As for the other cases in the original post, they are more than=20
frequently asked on StackOverflow.


On 12/22/13 10:29 AM, Billy O'Neal wrote:
> If so, then why is that?
>

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--------------070906030505060906070001
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

<html>
  <head>
    <meta content=3D"text/html; charset=3DUTF-8" http-equiv=3D"Content-Type=
">
  </head>
  <body text=3D"#000000" bgcolor=3D"#FFFFFF">
    <div class=3D"moz-cite-prefix">Is this discussion on-topic here? This
      isn't the std-discussion list, but even if it were, this would all
      be answered much faster on StackOverflow, likely by linking to a
      preexisting Q&amp;A page.<br>
      <br>
      Simply referring to the C++11 spec, "<span style=3D"font-size:
        10.000000pt; font-family: 'LMRoman10'">The result [of prefix ++]
        is the updated operand; it is an lvalue=85",</span>
      <title>C++ International Standard</title>
      and of compound assignment expressions to which prefix ++ is
      equivalent, "I<span style=3D"font-size: 10.000000pt; font-family:
        'LMRoman10'">n all cases, the assignment is sequenced after the
        value
        computation of the right and left operands, and before the value
        computation of the assignment expression.</span><span
        style=3D"font-size: 10.000000pt; font-family: 'LMRoman10'">"</span>
      <br>
      <br>
      It doesn't really matter anyway; you shouldn't write ++s=3D10 or
      ++++s whether or not it's well-defined. To play devil's advocate,
      such expressions may be produced by macros, but only the sort of
      macro that should be replaced by an inline function.<br>
      <br>
      As for the other cases in the original post, they are more than
      frequently asked on StackOverflow.<br>
      <br>
      <br>
      On 12/22/13 10:29 AM, Billy O'Neal wrote:<br>
    </div>
    <blockquote
cite=3D"mid:CAPBZbvwQVD8NXWBd1QbrfN4bbMH0MpkvxBLqDb_nBHGU5Mvqdg@mail.gmail.=
com"
      type=3D"cite">
      <pre wrap=3D"">If so, then why is that?

</pre>
    </blockquote>
    <br>
  </body>
</html>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--------------070906030505060906070001--

.


Author: "Billy O'Neal" <billy.oneal@gmail.com>
Date: Sat, 21 Dec 2013 19:33:35 -0800
Raw View
--089e0122a6c0846d4304ee172f05
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Makes sense. Thanks David!

Billy O'Neal
https://github.com/BillyONeal/ <https://bitbucket.org/BillyONeal/>
http://stackoverflow.com/users/82320/billy-oneal
Malware Response Instructor - BleepingComputer.com


On Sat, Dec 21, 2013 at 7:31 PM, David Krauss <potswa@gmail.com> wrote:

>  Is this discussion on-topic here? This isn't the std-discussion list,
> but even if it were, this would all be answered much faster on
> StackOverflow, likely by linking to a preexisting Q&A page.
>
> Simply referring to the C++11 spec, "The result [of prefix ++] is the
> updated operand; it is an lvalue=85", and of compound assignment
> expressions to which prefix ++ is equivalent, "In all cases, the
> assignment is sequenced after the value computation of the right and left
> operands, and before the value computation of the assignment expression."
>
> It doesn't really matter anyway; you shouldn't write ++s=3D10 or ++++s
> whether or not it's well-defined. To play devil's advocate, such
> expressions may be produced by macros, but only the sort of macro that
> should be replaced by an inline function.
>
> As for the other cases in the original post, they are more than frequentl=
y
> asked on StackOverflow.
>
>
>
> On 12/22/13 10:29 AM, Billy O'Neal wrote:
>
> If so, then why is that?
>
>
>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--089e0122a6c0846d4304ee172f05
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Makes sense. Thanks David!</div><div class=3D"gmail_extra"=
><br clear=3D"all"><div><div dir=3D"ltr"><div>Billy O&#39;Neal</div><div><a=
 href=3D"https://bitbucket.org/BillyONeal/" target=3D"_blank">https://githu=
b.com/BillyONeal/</a></div>

<div><a href=3D"http://stackoverflow.com/users/82320/billy-oneal" target=3D=
"_blank">http://stackoverflow.com/users/82320/billy-oneal</a></div><div>Mal=
ware Response Instructor - BleepingComputer.com</div></div></div>
<br><br><div class=3D"gmail_quote">On Sat, Dec 21, 2013 at 7:31 PM, David K=
rauss <span dir=3D"ltr">&lt;<a href=3D"mailto:potswa@gmail.com" target=3D"_=
blank">potswa@gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail=
_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:=
1ex">


 =20
   =20
 =20
  <div text=3D"#000000" bgcolor=3D"#FFFFFF">
    <div>Is this discussion on-topic here? This
      isn&#39;t the std-discussion list, but even if it were, this would al=
l
      be answered much faster on StackOverflow, likely by linking to a
      preexisting Q&amp;A page.<br>
      <br>
      Simply referring to the C++11 spec, &quot;<span style=3D"font-size:10=
..000000pt;font-family:&#39;LMRoman10&#39;">The result [of prefix ++]
        is the updated operand; it is an lvalue=85&quot;,</span>
     =20
      and of compound assignment expressions to which prefix ++ is
      equivalent, &quot;I<span style=3D"font-size:10.000000pt;font-family:&=
#39;LMRoman10&#39;">n all cases, the assignment is sequenced after the
        value
        computation of the right and left operands, and before the value
        computation of the assignment expression.</span><span style=3D"font=
-size:10.000000pt;font-family:&#39;LMRoman10&#39;">&quot;</span>
      <br>
      <br>
      It doesn&#39;t really matter anyway; you shouldn&#39;t write ++s=3D10=
 or
      ++++s whether or not it&#39;s well-defined. To play devil&#39;s advoc=
ate,
      such expressions may be produced by macros, but only the sort of
      macro that should be replaced by an inline function.<br>
      <br>
      As for the other cases in the original post, they are more than
      frequently asked on StackOverflow.<div class=3D"im"><br>
      <br>
      <br>
      On 12/22/13 10:29 AM, Billy O&#39;Neal wrote:<br>
    </div></div><div class=3D"im">
    <blockquote type=3D"cite">
      <pre>If so, then why is that?

</pre>
    </blockquote>
    <br>
  </div></div><div class=3D"HOEnZb"><div class=3D"h5">


<p></p>

-- <br>
=A0<br>
--- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org" target=3D=
"_blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</div></div></blockquote></div><br></div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--089e0122a6c0846d4304ee172f05--

.