Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Behaviour

Reply
Thread Tools

Behaviour

 
 
prasoonthegreat@gmail.com
Guest
Posts: n/a
 
      03-29-2009
int i=3;
printf("%d %d %d",++i,i,i++);

I want to know whether the above shows Undefined Behaviour or
Unspecified Behaviour ????
 
Reply With Quote
 
 
 
 
Keith Thompson
Guest
Posts: n/a
 
      03-29-2009
http://www.velocityreviews.com/forums/(E-Mail Removed) writes:
> int i=3;
> printf("%d %d %d",++i,i,i++);
>
> I want to know whether the above shows Undefined Behaviour or
> Unspecified Behaviour ????


It's undefined behavior. See C99 6.5p2.

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
 
 
 
Barry Schwarz
Guest
Posts: n/a
 
      03-29-2009
On Sun, 29 Mar 2009 00:20:49 -0700 (PDT), (E-Mail Removed)
wrote:

>int i=3;
>printf("%d %d %d",++i,i,i++);
>
>I want to know whether the above shows Undefined Behaviour or
>Unspecified Behaviour ????


Read the faq at www.c-faq.com. Your question is 3.2 but you should
read the whole thing.

--
Remove del for email
 
Reply With Quote
 
prasoonthegreat@gmail.com
Guest
Posts: n/a
 
      03-29-2009
here ',' in the printf statement is not a sequence point .....
am I correct???
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      03-29-2009
(E-Mail Removed) writes:
> here ',' in the printf statement is not a sequence point .....
> am I correct???


Correct -- "here" being in the code in the previous article, which we
can't see in your followup. When you post a followup, please keep
enough quoted context from the previous article so your followup makes
some sense to a reader who didn't see (or has forgotten) the previous
article.

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      03-30-2009
(E-Mail Removed) wrote:
>
> int i=3;
> printf("%d %d %d",++i,i,i++);
>
> I want to know whether the above shows Undefined Behaviour or
> Unspecified Behaviour ????


Undefined.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
debugger behaviour different to execution behaviour Andy Chambers Java 1 05-14-2007 09:51 AM
Strange mouse behaviour with flash in Mozilla 1.3.7 hpoppe Firefox 0 11-07-2004 12:16 PM
Strange taskbar behaviour (notification area) Falcon Wireless Networking 0 08-17-2004 09:03 AM
[mozilla1.6] strange behaviour with newsgroup joost68 Firefox 5 04-03-2004 03:48 AM
A curious behaviour with an URL on the W3C Griffure Firefox 0 08-11-2003 11:46 AM



Advertisments