Re: printf execution problem




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

.



Relevant Pages

  • Re: printf execution problem
    ... >>> Does printf output depends on compilers or operating systems? ... >>> or Compiler??? ... Because the standard says so. ...
    (comp.lang.c)
  • Re: printf execution problem
    ... > Does printf output depends on compilers or operating systems? ... > int main ... The values can be explained by compiler behaviour outside the scope of ... the C standard makes no specification of the order in ...
    (comp.lang.c)
  • Re: It Pays to Enrich Your C Skills
    ... Check if you can score a perfect 10 (without using a compiler). ... int main{ ... struct bitfield { ... out if it is a negative integer constant or a constant expression ...
    (comp.lang.c.moderated)
  • OT: Re: Perl Peeves
    ... I see the result of a test being used as an int. ... the compiler just assumed you knew what you were doing ... introduced to the language later, so void * was unheard of in most code. ... This didn't mean bool was special, declaring it just signaled to the ...
    (comp.lang.perl.misc)
  • Re: OT: Re: Perl Peeves
    ... when I see the result of a test being used as an int. ... compiler just assumed you knew what you were doing and would ... This didn't mean bool was special, declaring it just signaled to the ... What "normalization of bool results is built into the compiler"? ...
    (comp.lang.perl.misc)