Re: printf execution problem
- From: "Jaspreet" <jsingh.oberoi@xxxxxxxxx>
- Date: 30 Sep 2005 08:52:07 -0700
rahul8143@xxxxxxxxx wrote:
> David Resnick wrote:
> > rahul8...@xxxxxxxxx wrote:
> > > Does printf output depends on compilers or operating systems? I have
> > > one program
> > > int main()
> > > {
> > > int i=5;
> > > printf("%d %d %d",i++,i++,i++);
> > > return 0;
> > > }
> > > Output of this program on DOS (TC) 7 6 5
> > > Output of this program on Windows (VC++) 5 5 5
> > > Output of this program on Linux (GCC) 7 6 5
> > > so these outputs conlude that behaviour of this program is undefined.
> > > is that right?
> > > but can anybody have any other answer to this behaviour in terms of OS
> > > or Compiler???
> > > Thanks for help.
> >
> > Learn to read the group and FAQ before posting, this is asked all the
> > time.
> > http://www.eskimo.com/~scs/C-faq/q3.2.html
> >
> I have first read above link and then decided to ask question. The
> link said that such programs behaviour is undefined and depends on
> compiler. But i thought that is there any hidden relationship of this
> behaviour to OS. Nowadays no one uses DOS but everybody says to use GCC
> but most people also uses VC++. so doesn't it create a war of
> compilers(which to use?)
> > I wish google groups supported killfiles.
> >
> > -David
If you have read the FAQ link then you should not be asking such a
question again and again. Does the link not say undefined behavior ? If
it is undefined then there is no point for me, you or any other Tom,
*** or Harry to try and explain the output.
I would rather suggest you to study on sequence points. After that,
there are a whole lot of other topics which do give you some defined
behavior irrespective of what compilers or platform you are using. It
would prove more beneficial for all if you rather concentrate on those
topics and ask queries on those topics instead.
I wish David's suggestion of killfiles is taken note of.
.
- References:
- Re: printf execution problem
- From: rahul8143
- Re: printf execution problem
- Prev by Date: Re: Global variables
- Next by Date: Re: Global variables
- Previous by thread: Re: printf execution problem
- Next by thread: Re: printf execution problem
- Index(es):