This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: is the c code in gcc comiled sequentially???




Ian Lance Taylor-3 wrote:
> 
> 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
> 
> 
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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]