public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: enggakshat <enggakshat@yahoo.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: is the c code in gcc comiled sequentially???
Date: Wed, 15 Nov 2006 15:35:00 -0000	[thread overview]
Message-ID: <m3irhgwwot.fsf@localhost.localdomain> (raw)
In-Reply-To: <7359255.post@talk.nabble.com>

enggakshat <enggakshat@yahoo.com> writes:

> for the following simple code i thought its obvious that 'hello' is printed
> but that doesnt happen.
> as far as i knew the code is executed sequentially. 
> 
> #include<iostream>
> 
> using namespace std;
> 
> int main()
> 
> {
>  int i=0;
>  cout<<"hello";
>  while(1)
>  {
>   i++;
>  }
> }

This is most likely a buffering issue.  std::cout is normally line
buffered by default, which means that it is only flushed when you
output a newline character.  Try this:
    cout << unitbuf << "hello";

Ian

  reply	other threads:[~2006-11-15 15:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-15  6:13 enggakshat
2006-11-15 12:20 ` John Love-Jensen
2006-11-15 15:07   ` enggakshat
2006-11-15 15:35     ` Ian Lance Taylor [this message]
2006-11-15 17:57       ` enggakshat
2006-11-15 19:18         ` Young, Michael
2006-11-15 15:38     ` John Love-Jensen
2006-11-15 17:55       ` enggakshat
2006-11-15 16:15 Kaz Kylheku

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3irhgwwot.fsf@localhost.localdomain \
    --to=iant@google.com \
    --cc=enggakshat@yahoo.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).