From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12469 invoked by alias); 15 Nov 2006 19:18:59 -0000 Received: (qmail 12460 invoked by uid 22791); 15 Nov 2006 19:18:59 -0000 X-Spam-Check-By: sourceware.org Received: from host64-80-108-51.paetec.com (HELO mail1-corp.corp.paetec.com) (64.80.108.51) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 15 Nov 2006 19:18:50 +0000 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: is the c code in gcc comiled sequentially??? Date: Wed, 15 Nov 2006 19:18:00 -0000 Message-ID: In-Reply-To: <7362882.post@talk.nabble.com> From: "Young, Michael" To: "enggakshat" , 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/msg00213.txt.bz2 I recommend Langer and Kreft's book, "Standard C++ IOStreams and Locales: Advanced Programmer's Guide and Reference" for a full explanation of iostr= eams and the underlying classes. Be aware that flush (which writes out any buffered characters) is invoked b= y endl, so any statements written similar to the following should work as you were expecting : std::cout << "your text here" << std::endl ; HTH, Mike Young -----Original Message----- From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org]On Behalf Of enggakshat Sent: Wednesday, November 15, 2006 12:58 PM To: gcc-help@gcc.gnu.org Subject: Re: is the c code in gcc comiled sequentially??? Ian Lance Taylor-3 wrote: >=20 > enggakshat writes: >=20 >> 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.=20 >>=20 >> #include >>=20 >> using namespace std; >>=20 >> int main() >>=20 >> { >> int i=3D0; >> cout<<"hello"; >> while(1) >> { >> i++; >> } >> } >=20 > 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"; >=20 > Ian >=20 >=20 thanks a lot .it worked.is there any suggested reading from where i can get more info on buffers in c++ regards Akshat --=20 View this message in context: http://www.nabble.com/is-the-c-code-in-gcc-co= mpiled-sequentially----tf2634251.html#a7362882 Sent from the gcc - Help mailing list archive at Nabble.com.