From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18596 invoked by alias); 15 Nov 2006 17:57:42 -0000 Received: (qmail 18585 invoked by uid 22791); 15 Nov 2006 17:57:41 -0000 X-Spam-Check-By: sourceware.org Received: from www.nabble.com (HELO talk.nabble.com) (72.21.53.35) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 15 Nov 2006 17:57:35 +0000 Received: from [72.21.53.38] (helo=jubjub.nabble.com) by talk.nabble.com with esmtp (Exim 4.50) id 1GkP0w-0005Ld-9C for gcc-help@gcc.gnu.org; Wed, 15 Nov 2006 09:57:34 -0800 Message-ID: <7362882.post@talk.nabble.com> Date: Wed, 15 Nov 2006 17:57:00 -0000 From: enggakshat To: gcc-help@gcc.gnu.org Subject: Re: is the c code in gcc comiled sequentially??? In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: enggakshat@yahoo.com References: <7352560.post@talk.nabble.com> <7359255.post@talk.nabble.com> X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2006-11/txt/msg00212.txt.bz2 Ian Lance Taylor-3 wrote: > > enggakshat 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 >> >> 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 > > thanks a lot .it worked.is there any suggested reading from where i can get more info on buffers in c++ regards Akshat -- View this message in context: http://www.nabble.com/is-the-c-code-in-gcc-compiled-sequentially----tf2634251.html#a7362882 Sent from the gcc - Help mailing list archive at Nabble.com.