Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Re: Unpredictab...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 10 of 12 Topic 45818 of 47032
Post > Topic >>

Re: Unpredictable nature of increment operators

by Old Wolf <oldwolf@[EMAIL PROTECTED] > May 11, 2008 at 02:14 AM

On May 11, 3:01 am, Jerry Coffin <jcof...@[EMAIL PROTECTED]
> wrote:
> > On 9 mai, 19:21, "Victor Bazarov" <v.Abaza...@[EMAIL PROTECTED]
> wrote:
> > > For example, it's not undefined behaviour to do
> > > >     f(i++) + ++i;
>
> I believe the compiler is required to treat evaluation of a
> function argument and calling the function as atomic -- i.e. once the
> evaluation of any argument takes place, it must proceed to evaluated the
> other arguments (if any) and then call the function.

There is no such requirement. In the following code,
for example,:
  foo( bar(), baz() ) + qux();

the order of calling functions could be:
  baz, qux, bar, foo.

or any other ordering, so long as 'foo' comes after
both 'bar' and 'baz'.

The code of Victor Bazarov causes undefined behaviour
if 'i' is a builtin type, because there might not be
a sequence point between the two modifications of 'i'.
 




 12 Posts in Topic:
Unpredictable nature of increment operators
bintom <binoythomas110  2008-05-08 17:16:56 
Re: Unpredictable nature of increment operators
Ian Collins <ian-news@  2008-05-09 12:17:58 
Re: Unpredictable nature of increment operators
Martin York <Martin.Yo  2008-05-09 10:11:08 
Re: Unpredictable nature of increment operators
"Victor Bazarov"  2008-05-09 13:21:26 
Re: Unpredictable nature of increment operators
Jerry Coffin <jcoffin@  2008-05-10 08:47:59 
Re: Unpredictable nature of increment operators
James Kanze <james.kan  2008-05-10 07:08:42 
Re: Unpredictable nature of increment operators
Jerry Coffin <jcoffin@  2008-05-10 09:01:10 
Re: Unpredictable nature of increment operators
"Bo Persson" &l  2008-05-11 10:56:59 
Re: Unpredictable nature of increment operators
Jerry Coffin <jcoffin@  2008-05-11 09:05:09 
Re: Unpredictable nature of increment operators
Old Wolf <oldwolf@[EMA  2008-05-11 02:14:44 
Re: Unpredictable nature of increment operators
James Kanze <james.kan  2008-05-11 09:09:34 
Re: Unpredictable nature of increment operators
James Kanze <james.kan  2008-05-11 09:19:28 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 15:56:31 CDT 2008.